white-airport-48392
04/22/2020, 8:59 AMtall-librarian-49374
04/22/2020, 4:06 PMwhite-airport-48392
04/23/2020, 2:48 AMtall-librarian-49374
04/23/2020, 1:07 PMwhite-airport-48392
04/24/2020, 3:55 AMtall-librarian-49374
04/24/2020, 9:34 AMwhite-airport-48392
04/24/2020, 2:29 PMdev
import pulumi
from pulumi_aws import ec2
config = pulumi.Config("modules")
ecs_config = config.get_object("ecs")
pulumi.export("ecs_config",ecs_config)
Project B , stack : res-dev
import pulumi
from pulumi_aws import ecs
infra = pulumi.StackReference("dev")
stack_props = stack_props("ecs_config")
config = pulumi.Config()
features = config.get_object("enabled")
features.get("ecs")
Integration test against Project B
:
package pulumi
import (
"os"
"path"
"testing"
"<http://github.com/pulumi/pulumi/pkg/testing/integration|github.com/pulumi/pulumi/pkg/testing/integration>"
)
func TestExamples(t *testing.T) {
awsRegion := os.Getenv("AWS_REGION")
if awsRegion == "" {
awsRegion = "us-west-2"
}
cwd, _ := os.Getwd()
integration.ProgramTest(t, &integration.ProgramTestOptions{
Quick: true,
SkipRefresh: true,
Dir: path.Join(cwd, "..", "..", "resources"),
Config: map[string]string{
"aws:region": awsRegion,
"modules:enabled": {
"rds": false,
"ecs": true,
},
},
UpdateCommandlineFlags: []string{"--non-interactive", "--yes"},
// StackName: "res-devasdad",
})
}
Error from Integration Test :
Diagnostics:
[ evops/profilex-infra/resources ] pulumi:pulumi:Stack (resources-p-it-hgirija-in-resources-2b374e31):
[ evops/profilex-infra/resources ] error: Program failed with an unhandled exception:
[ evops/profilex-infra/resources ] error: Traceback (most recent call last):
[ evops/profilex-infra/resources ] File "/usr/local/bin/pulumi-language-python-exec", line 85, in <module>
[ evops/profilex-infra/resources ] loop.run_until_complete(coro)
[ evops/profilex-infra/resources ] File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
[ evops/profilex-infra/resources ] return future.result()
[ evops/profilex-infra/resources ] File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py", line 180, in _step
[ evops/profilex-infra/resources ] result = coro.send(None)
[ evops/profilex-infra/resources ] File "/Users/hgirija/codebase/profiles/devops/profilex-infra/network/venv/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 81, in run_in_stack
[ evops/profilex-infra/resources ] await run_pulumi_func(lambda: Stack(func))
[ evops/profilex-infra/resources ] File "/Users/hgirija/codebase/profiles/devops/profilex-infra/network/venv/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 34, in run_pulumi_func
[ evops/profilex-infra/resources ] func()
[ evops/profilex-infra/resources ] File "/Users/hgirija/codebase/profiles/devops/profilex-infra/network/venv/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 81, in <lambda>
[ evops/profilex-infra/resources ] await run_pulumi_func(lambda: Stack(func))
[ evops/profilex-infra/resources ] File "/Users/hgirija/codebase/profiles/devops/profilex-infra/network/venv/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 104, in __init__
[ evops/profilex-infra/resources ] func()
[ evops/profilex-infra/resources ] File "/usr/local/bin/pulumi-language-python-exec", line 84, in <lambda>
[ evops/profilex-infra/resources ] coro = pulumi.runtime.run_in_stack(lambda: runpy.run_path(args.PROGRAM, run_name='__main__'))
[ evops/profilex-infra/resources ] File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 280, in run_path
[ evops/profilex-infra/resources ] run_name, mod_spec, pkg_name).copy()
[ evops/profilex-infra/resources ] File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
[ evops/profilex-infra/resources ] exec(code, run_globals)
[ evops/profilex-infra/resources ] File "./__main__.py", line 4, in <module>
[ evops/profilex-infra/resources ] from modules.rds import RDS
[ evops/profilex-infra/resources ] File "./modules/rds.py", line 8, in <module>
[ evops/profilex-infra/resources ] engine = props.get("engine")
[ evops/profilex-infra/resources ] AttributeError: 'NoneType' object has no attribute 'get'
[ evops/profilex-infra/resources ] error: an unhandled error occurred: Program exited with non-zero exit code: 1
[ evops/profilex-infra/resources ]
[ evops/profilex-infra/resources ] Resources:
[ evops/profilex-infra/resources ] + 1 created
Issue 1 :Basically in
features = config.get_object("enabled")
features is Nonetype during integration test ,
Issue 2 : Just the Stackreference get portion also throws a similar error
Questions: How to get an integration test of a Project to use StackReference and Config @tall-librarian-49374tall-librarian-49374
04/24/2020, 2:56 PMStackReference
constructor takes as input a string of the form <organization>/<project>/<stack>
dev
isn’t enough AFAIKmodules
your project name? What if you try
config = pulumi.Config("modules")
white-airport-48392
04/24/2020, 3:51 PMdev
works just fine when doing pulumi preview/up , this problem is when integration testing ,
Should I try using the form you have suggested ?config = pulumi.Config("modules")
Unfortunately It did not worktall-librarian-49374
04/24/2020, 4:35 PMworks just fine when doing pulumi preview/upHmm, how does it know it needs to pick up Project A?
white-airport-48392
04/24/2020, 5:57 PMtall-librarian-49374
04/24/2020, 7:50 PMWhat if I need to have objects in my stack configI am told you should pass them as JSON strings
white-airport-48392
04/25/2020, 5:19 AMStack is not unique across projects. I have like 200 dev stacks 🙂Hmm , I may be wrong , but I am not logged into the Pulumi service backend , but a self managed S3 bucket as backend. Stack names are definitely unique from what I have tried , I am not able to create a dev stack in a different project
error: stack 'dev' already exists
And since I am using a self managed backend , I infact cannot create a stack in this <project>/<stack>
format , I get
error: stack names may not contain slashes
Ok , I can definitely try stringifying the JSON ,
Stack Reference is what I am most interested in getting to work🙂
Thank you for helping me out here 🙂tall-librarian-49374
04/25/2020, 5:10 PMwhite-airport-48392
04/25/2020, 5:34 PMtall-librarian-49374
04/25/2020, 8:29 PMwhite-airport-48392
04/27/2020, 6:13 AM[ evops/profilex-infra/resources ] **** Invoke '/usr/local/bin/pulumi destroy --non-interactive --skip-preview' in '/var/folders/2l/gws8tbdx51jcm5tb63w_gcd4_dzl53/T/p-it-hgirija-in-resources-496ad2c0-277252398'
[ evops/profilex-infra/resources ] Invoke '/usr/local/bin/pulumi destroy --non-interactive --skip-preview' failed: exit status 255
[ evops/profilex-infra/resources ] error: --yes must be passed in to proceed when running in non-interactive mode
I am passing UpdateCommandlineFlags: []_string_{"--yes", "--non-interactive"},
Still getting the issue ,
Using require <http://github.com/pulumi/pulumi/pkg|github.com/pulumi/pulumi/pkg> v1.13.1
in go.mod and pulumi CLI version 2.0tall-librarian-49374
04/27/2020, 7:57 AM--yes
is passed automatically there: https://github.com/pulumi/pulumi/blob/master/pkg/testing/integration/program.go#L1044white-airport-48392
04/28/2020, 4:57 AMtall-librarian-49374
04/28/2020, 6:27 AMwhite-airport-48392
04/28/2020, 8:43 AMconfig:
aws:region: us-west-2
modules:s3:
name: profilex-test
Above is my Pulumi.dev.yaml
"use strict";
const pulumi = require("@pulumi/pulumi");
const pulumiAws = require("@pulumi/aws");
const config = new pulumi.Config("modules");
const s3Config = config.getObject("s3");
const bucket = new pulumiAws.s3.Bucket(s3Config["name"]);
module.exports = { bucketId: s3Config["name"] };
For this configuration When I ran my integration test I always get
+ pulumi:pulumi:Stack resources-p-it-hgirija-in-resources-08eb2c2b **creating failed** 1 error
[ evops/profilex-infra/resources ]
[ evops/profilex-infra/resources ] Diagnostics:
[ evops/profilex-infra/resources ] pulumi:pulumi:Stack (resources-p-it-hgirija-in-resources-08eb2c2b):
[ evops/profilex-infra/resources ] error: Running program '/private/var/folders/2l/gws8tbdx51jcm5tb63w_gcd4_dzl53/T/p-it-hgirija-in-resources-08eb2c2b-196473312' failed with an unhandled exception:
[ evops/profilex-infra/resources ] TypeError: Cannot read property 'name' of undefined
[ evops/profilex-infra/resources ] at Object.<anonymous> (/private/var/folders/2l/gws8tbdx51jcm5tb63w_gcd4_dzl53/T/p-it-hgirija-in-resources-08eb2c2b-196473312/index.js:12:48)
[ evops/profilex-infra/resources ] at Module._compile (internal/modules/cjs/loader.js:1156:30)
[ evops/profilex-infra/resources ] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
[ evops/profilex-infra/resources ] at Module.load (internal/modules/cjs/loader.js:1000:32)
[ evops/profilex-infra/resources ] at Function.Module._load (internal/modules/cjs/loader.js:899:14)
[ evops/profilex-infra/resources ] at Module.require (internal/modules/cjs/loader.js:1042:19)
[ evops/profilex-infra/resources ] at require (internal/modules/cjs/helpers.js:77:18)
[ evops/profilex-infra/resources ] at Object.<anonymous> (/private/var/folders/2l/gws8tbdx51jcm5tb63w_gcd4_dzl53/T/p-it-hgirija-in-resources-08eb2c2b-196473312/node_modules/@pulumi/pulumi/cmd/run/run.js:214:31)
[ evops/profilex-infra/resources ] at Generator.next (<anonymous>)
[ evops/profilex-infra/resources ] at /private/var/folders/2l/gws8tbdx51jcm5tb63w_gcd4_dzl53/T/p-it-hgirija-in-resources-08eb2c2b-196473312/node_modules/@pulumi/pulumi/cmd/run/run.js:21:71
[ evops/profilex-infra/resources ]
[ evops/profilex-infra/resources ] Resources:
[ evops/profilex-infra/resources ] + 1 created
[ evops/profilex-infra/resources ]
[ evops/profilex-infra/resources ] Duration: 16s
s3Config
Is always undefined !
Am I doing something wrongtall-librarian-49374
04/28/2020, 2:36 PMdev
. If you don’t set StackName
explicitly, it would be generated to something like p-it-hgirija-in-resources-08eb2c2b-196473312
white-airport-48392
04/28/2020, 5:06 PMStill running command '/usr/local/bin/pulumi stack init dev' (/var/folders/2l/gws8tbdx51jcm5tb63w_gcd4_dzl53/T/dev-924744879)...
panic: test timed out after 10m0s
goroutine 54 [running]:
testing.(*M).startAlarm.func1()
/usr/local/go/src/testing/testing.go:1460 +0xdf
created by time.goFunc
/usr/local/go/src/time/sleep.go:168 +0x44
goroutine 1 [chan receive, 10 minutes]:
testing.tRunner.func1(0xc000248b40)
/usr/local/go/src/testing/testing.go:957 +0x238
testing.tRunner(0xc000248b40, 0xc0006bfe10)
/usr/local/go/src/testing/testing.go:996 +0x10b
testing.runTests(0xc00071f880, 0x5c86300, 0x1, 0x1, 0x0)
/usr/local/go/src/testing/testing.go:1283 +0x2a7
testing.(*M).Run(0xc000736d00, 0x0)
/usr/local/go/src/testing/testing.go:1200 +0x15f
main.main()
_testmain.go:44 +0x135
goroutine 19 [chan receive]:
<http://github.com/golang/glog.(*loggingT).flushDaemon(0x5c9f9c0)|github.com/golang/glog.(*loggingT).flushDaemon(0x5c9f9c0)>
/Users/hooman/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:882 +0x8b
created by <http://github.com/golang/glog.init.0|github.com/golang/glog.init.0>
/Users/hooman/go/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:410 +0x26f
goroutine 20 [select]:
<http://go.opencensus.io/stats/view.(*worker).start(0xc000234820)|go.opencensus.io/stats/view.(*worker).start(0xc000234820)>
/Users/hooman/go/pkg/mod/go.opencensus.io@v0.22.3/stats/view/worker.go:154 +0x100
created by <http://go.opencensus.io/stats/view.init.0|go.opencensus.io/stats/view.init.0>
/Users/hooman/go/pkg/mod/go.opencensus.io@v0.22.3/stats/view/worker.go:32 +0x57
goroutine 8 [chan receive, 10 minutes]:
<http://github.com/rjeczalik/notify.(*recursiveTree).dispatch(0xc00072f400)|github.com/rjeczalik/notify.(*recursiveTree).dispatch(0xc00072f400)>
/Users/hooman/go/pkg/mod/github.com/rjeczalik/notify@v0.9.2/tree_recursive.go:125 +0xc4
created by <http://github.com/rjeczalik/notify.newRecursiveTree|github.com/rjeczalik/notify.newRecursiveTree>
/Users/hooman/go/pkg/mod/github.com/rjeczalik/notify@v0.9.2/tree_recursive.go:119 +0x132
goroutine 9 [syscall, 10 minutes, locked to thread]:
<http://github.com/rjeczalik/notify._Cfunc_CFRunLoopRun()|github.com/rjeczalik/notify._Cfunc_CFRunLoopRun()>
_cgo_gotypes.go:232 +0x41
<http://github.com/rjeczalik/notify.init.1.func1()|github.com/rjeczalik/notify.init.1.func1()>
/Users/hooman/go/pkg/mod/github.com/rjeczalik/notify@v0.9.2/watcher_fsevents_cgo.go:72 +0x3c
created by <http://github.com/rjeczalik/notify.init.1|github.com/rjeczalik/notify.init.1>
/Users/hooman/go/pkg/mod/github.com/rjeczalik/notify@v0.9.2/watcher_fsevents_cgo.go:63 +0x4e
goroutine 10 [syscall, 5 minutes]:
syscall.syscall6(0x4082900, 0x15b2, 0xc000a71354, 0x0, 0xc0003fa5a0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/runtime/sys_darwin.go:74 +0x2e
syscall.wait4(0x15b2, 0xc000a71354, 0x0, 0xc0003fa5a0, 0x90, 0x4fc1700, 0x1)
/usr/local/go/src/syscall/zsyscall_darwin_amd64.go:44 +0x87
syscall.Wait4(0x15b2, 0xc000a713a4, 0x0, 0xc0003fa5a0, 0x203000, 0x0, 0xc000a71438)
/usr/local/go/src/syscall/syscall_bsd.go:129 +0x51
os.(*Process).wait(0xc000584270, 0x5050308, 0x5050310, 0x5050300)
/usr/local/go/src/os/exec_unix.go:38 +0x7b
os.(*Process).Wait(...)
/usr/local/go/src/os/exec.go:125
os/exec.(*Cmd).Wait(0xc000972160, 0x0, 0x0)
/usr/local/go/src/os/exec/exec.go:502 +0x60
os/exec.(*Cmd).Run(0xc000972160, 0xc00027faa0, 0x0)
/usr/local/go/src/os/exec/exec.go:340 +0x5c
os/exec.(*Cmd).CombinedOutput(0xc000972160, 0x13, 0x0, 0x0, 0x28, 0xc0004f0500)
/usr/local/go/src/os/exec/exec.go:562 +0x91
<http://github.com/pulumi/pulumi/pkg/v2/testing/integration.RunCommand(0xc000248c60|github.com/pulumi/pulumi/pkg/v2/testing/integration.RunCommand(0xc000248c60>, 0x5001a85, 0x11, 0xc00004c040, 0x4, 0x4, 0xc0007247d0, 0x42, 0xc000298200, 0x0, ...)
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/command.go:73 +0xdff
<http://github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).runCommand(...)|github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).runCommand(...)>
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/program.go:717
<http://github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).runPulumiCommand.func1(0x0|github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).runPulumiCommand.func1(0x0>, 0x8f0d180, 0x3, 0xc000a719c8, 0x4c9f4d7, 0x4d85160, 0xc00004c050)
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/program.go:760 +0xb0
<http://github.com/pulumi/pulumi/sdk/v2/go/common/util/retry.Until(0x530ab40|github.com/pulumi/pulumi/sdk/v2/go/common/util/retry.Until(0x530ab40>, 0xc000210008, 0xc000a71aa0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x1, ...)
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/common/util/retry/until.go:74 +0xcf
<http://github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).runPulumiCommand(0xc0005ea5a0|github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).runPulumiCommand(0xc0005ea5a0>, 0x5001a85, 0x11, 0xc000a71c90, 0x3, 0x3, 0xc0007247d0, 0x42, 0x0, 0x0, ...)
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/program.go:758 +0x25c
<http://github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).TestLifeCycleInitialize(0xc0005ea5a0|github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).TestLifeCycleInitialize(0xc0005ea5a0>, 0xc0007247d0, 0x42)
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/program.go:1005 +0x4d6
<http://github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).TestLifeCycleInitAndDestroy(0xc0005ea5a0|github.com/pulumi/pulumi/pkg/v2/testing/integration.(*ProgramTester).TestLifeCycleInitAndDestroy(0xc0005ea5a0>, 0x0, 0x0)
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/program.go:904 +0xf0
<http://github.com/pulumi/pulumi/pkg/v2/testing/integration.ProgramTest(0xc000248c60|github.com/pulumi/pulumi/pkg/v2/testing/integration.ProgramTest(0xc000248c60>, 0xc000298200)
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/program.go:603 +0x5f
pulumi/integration_tests.TestExamples(0xc000248c60)
/Users/hooman/codebase/profiles/devops/infra/resources/tests/integration_test.go:19 +0x1cb
testing.tRunner(0xc000248c60, 0x5050348)
/usr/local/go/src/testing/testing.go:992 +0xdc
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1043 +0x357
goroutine 11 [chan receive, 10 minutes]:
testing.runTests.func1.1(0xc000248b40)
/usr/local/go/src/testing/testing.go:1290 +0x3b
created by testing.runTests.func1
/usr/local/go/src/testing/testing.go:1290 +0xac
goroutine 52 [sleep]:
time.Sleep(0x1bf08eb000)
/usr/local/go/src/runtime/time.go:198 +0xba
<http://github.com/pulumi/pulumi/pkg/v2/testing/integration.RunCommand.func2(0xc0005f204a|github.com/pulumi/pulumi/pkg/v2/testing/integration.RunCommand.func2(0xc0005f204a>, 0xc000298200, 0xc0005840f0, 0x28, 0xc0007247d0, 0x42)
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/command.go:42 +0x42
created by <http://github.com/pulumi/pulumi/pkg/v2/testing/integration.RunCommand|github.com/pulumi/pulumi/pkg/v2/testing/integration.RunCommand>
/Users/hooman/go/pkg/mod/github.com/pulumi/pulumi/pkg/v2@v2.0.0/testing/integration/command.go:40 +0x234
goroutine 53 [IO wait]:
internal/poll.runtime_pollWait(0x6759e38, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:203 +0x55
internal/poll.(*pollDesc).wait(0xc0001a02b8, 0x72, 0x301, 0x32c, 0xffffffffffffffff)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0001a02a0, 0xc0005c2ad4, 0x32c, 0x32c, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:169 +0x201
os.(*File).read(...)
/usr/local/go/src/os/file_unix.go:263
os.(*File).Read(0xc000010028, 0xc0005c2ad4, 0x32c, 0x32c, 0x1c, 0x0, 0x0)
/usr/local/go/src/os/file.go:116 +0x71
bytes.(*Buffer).ReadFrom(0xc00027faa0, 0x52e88a0, 0xc000010028, 0xe68a4c0, 0xc00027faa0, 0x1)
/usr/local/go/src/bytes/buffer.go:204 +0xb1
io.copyBuffer(0x52e52a0, 0xc00027faa0, 0x52e88a0, 0xc000010028, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:391 +0x2fc
io.Copy(...)
/usr/local/go/src/io/io.go:364
os/exec.(*Cmd).writerDescriptor.func1(0x0, 0x0)
/usr/local/go/src/os/exec/exec.go:310 +0x63
os/exec.(*Cmd).Start.func1(0xc000972160, 0xc00049a200)
/usr/local/go/src/os/exec/exec.go:436 +0x27
created by os/exec.(*Cmd).Start
/usr/local/go/src/os/exec/exec.go:435 +0x608
exit status 2
FAIL pulumi/integration_tests 601.530s
dev
It time out with the following message : Should a stack init be happening as part of the test if I specify a stackName?tall-librarian-49374
04/30/2020, 9:43 AMwhite-airport-48392
05/01/2020, 4:32 AM