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

witty-yacht-82771

10/30/2019, 11:19 AM
Hey, question about how to check values in testing. I have the following in my `index.ts`:
Copy code
export const service = new awsx.ecs.FargateService("click-router", {
  assignPublicIp: false,
  cluster,
  subnets: pubSubnets,
  desiredCount: 2,
  taskDefinition: taskDef
});
and then in my tests, I’m trying to do:
Copy code
it("should have 2 desired instances", async () => {
    const di = await promise(service.service.desiredCount);
    expect(di).to.equal(2);
  });
I get the error that the variable
di
is undefined. How can I do tests on assigned values prior to deploying?
g

gentle-diamond-70147

10/30/2019, 2:13 PM
do you get this error when doing an
up
or
preview
or are you executing pulumi in a different way?
w

witty-yacht-82771

10/30/2019, 4:50 PM
This is with an `up`…should I be using
preview
?
g

gentle-diamond-70147

10/30/2019, 4:53 PM
No, the tests will execute in both. Let me try to reproduce...
w

witty-yacht-82771

10/30/2019, 5:24 PM
thanks, let me know
g

gentle-diamond-70147

10/31/2019, 6:59 PM
@witty-yacht-82771 looks like this currently doesn't work in
preview
(https://github.com/pulumi/pulumi/issues/3429), but should work during the
up
. If you're running
pulumi up
, pulumi will run the preview first and if anything fails will not proceed to the update. You can skips the tests during the
up
by checking
pulumi.runtime.isDryRun()
.
w

witty-yacht-82771

11/03/2019, 12:07 PM
Cool, good to know, I’ll add that to my internal docs for now