Tweak to Azure JS Webserver
* Tweak to Azure JS Webserver
Also add to tests.
* Update config for test
MODIFY
.travis.yml
.travis.yml
@@ -11,7 +11,7 @@ before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.2.1
- export PATH=$HOME/.yarn/bin:$PATH
# Install Pulumi
- - curl -L https://get.pulumi.com/ | bash -s -- --version 0.15.0
+ - curl -L https://get.pulumi.com/ | bash -s -- --version 0.15.2
- export PATH=$HOME/.pulumi/bin:$PATH
install:
# Now restore all dependencies, after cloning, to rebuild vendor appropriately.

MODIFY
azure-js-webserver/index.js
azure-js-webserver/index.js
const pulumi = require("@pulumi/pulumi");
const azure = require("@pulumi/azure");
-let config = new pulumi.Config("webserver-azure");
+let config = new pulumi.Config();
let username = config.require("username");
let password = config.require("password");
@@ -83,9 +83,9 @@ let vm = new azure.compute.VirtualMachine("server-vm", {
// The public IP address is not allocated until the VM is running, so we wait
// for that resource to create, and then lookup the IP address again to report
// its public IP.
-exports.publicIP = vm.id.apply(_ =>
+exports.publicIP = pulumi.all({ id: vm.id, name: publicIP.name, resourceGroupName: publicIP.resourceGroupName }).apply(ip =>
azure.network.getPublicIP({
- name: publicIP.name,
- resourceGroupName: publicIP.resourceGroupName,
+ name: ip.name,
+ resourceGroupName: ip.resourceGroupName,
}).then(ip => ip.ipAddress)
);

MODIFY
misc/test/examples_test.go
misc/test/examples_test.go
@@ -17,10 +17,14 @@ import (
)
func TestExamples(t *testing.T) {
- region := os.Getenv("AWS_REGION")
- if region == "" {
+ awsRegion := os.Getenv("AWS_REGION")
+ if awsRegion == "" {
t.Skipf("Skipping test due to missing AWS_REGION environment variable")
}
+ azureEnviron := os.Getenv("ARM_ENVIRONMENT")
+ if azureEnviron == "" {
+ t.Skipf("Skipping test due to missing ARM_ENVIRONMENT variable")
+ }
cwd, err := os.Getwd()
if !assert.NoError(t, err, "expected a valid working directory: %v", err) {
return
@@ -35,7 +39,7 @@ func TestExamples(t *testing.T) {
Dir: path.Join(cwd, "..", "..", "aws-js-webserver"),
SkipBuild: true,
Config: map[string]string{
- "aws:region": "us-west-2",
+ "aws:region": awsRegion,
},
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
expectHelloWorld(t, stack.Outputs["publicHostName"])
@@ -45,12 +49,24 @@ func TestExamples(t *testing.T) {
Dir: path.Join(cwd, "..", "..", "aws-js-webserver-component"),
SkipBuild: true,
Config: map[string]string{
- "aws:region": "us-west-2",
+ "aws:region": awsRegion,
},
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
expectHelloWorld(t, stack.Outputs["webUrl"])
},
}),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "azure-js-webserver"),
+ SkipBuild: true,
+ Config: map[string]string{
+ "azure:environment": azureEnviron,
+ "username": "testuser",
+ "password": "testTEST1234+-*/",
+ },
+ ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
+ expectHelloWorld(t, stack.Outputs["publicIP"])
+ },
+ }),
// TODO[pulumi/pulumi#1606] This test is failing in CI, disabling until this issue is resolved.
// base.With(integration.ProgramTestOptions{
// Dir: path.Join(cwd, "..", "..", "aws-py-webserver"),
@@ -59,7 +75,7 @@ func TestExamples(t *testing.T) {
// DebugUpdates: true,
// SkipBuild: true,
// Config: map[string]string{
- // "aws:region": "us-west-2",
+ // "aws:region": awsRegion,
// },
// ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
// expectHelloWorld(t, stack.Outputs["public_dns"])

Tweak to Azure JS Webserver (#134)

* Tweak to Azure JS Webserver

Also add to tests.

* Update config for test