Hey, question about how to check values in testing...
# general
w
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
do you get this error when doing an
up
or
preview
or are you executing pulumi in a different way?
w
This is with an `up`…should I be using
preview
?
g
No, the tests will execute in both. Let me try to reproduce...
w
thanks, let me know
g
@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
Cool, good to know, I’ll add that to my internal docs for now