https://pulumi.com logo
#general
Title
# general
p

polite-motherboard-78438

03/21/2020, 3:51 PM
Hello. anyone with experience on doing unit / integration testing with Pulumi? I managed to to a basic test to check if my Kubernetes cluster was created with the specified tags. But now I would like to do some more tests to check for example an helm have received the correct values / a configMap would be created with a specific content? Can I do it in an "Unit test style" in Typescript or do I need to use the Go integration testing framework? I tried to following but didnt went well: ( TypeError: Cannot read property 'invoke' of undefined)
Copy code
test("It creates the correct configMap", done => {
    fluentBitChart
      .getResource("v1/ConfigMap", "fluent-bit-config")
        .apply(cm => {
          // TODO check if the data has correct value
        console.log(cm.urn);
        done();
      });
  });
Note that fluentBitChart is an instance of "k8s.helm.v3.Chart". Baically I want to write a test to validate the Helm resource received the correct values, some of them are reading from config etc
t

tall-librarian-49374

03/21/2020, 6:25 PM
You can do mock-based unit testing: you mock the engine and then use your favourite framework (e.g. Mocha) to write unit tests without creating resources. Is that what you want?
5 Views