Skip to content

Commit 01035e1

Browse files
authored
Add update fields for local and remote command (#57)
1 parent 8cd6bf9 commit 01035e1

File tree

24 files changed

+4297
-5
lines changed

24 files changed

+4297
-5
lines changed

examples/examples_nodejs_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,26 @@ func TestSimple(t *testing.T) {
8585
Additive: true,
8686
ExpectFailure: true,
8787
},
88+
{
89+
Dir: filepath.Join("simple", "update-change"),
90+
Additive: true,
91+
ExpectFailure: true,
92+
},
93+
},
94+
})
95+
integration.ProgramTest(t, &test)
96+
}
97+
98+
func TestSimpleWithUpdate(t *testing.T) {
99+
test := getJSBaseOptions(t).
100+
With(integration.ProgramTestOptions{
101+
Dir: filepath.Join(getCwd(t), "simple-with-update"),
102+
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {},
103+
EditDirs: []integration.EditDir{
104+
{
105+
Dir: filepath.Join("simple-with-update", "update-change"),
106+
Additive: true,
107+
},
88108
},
89109
})
90110
integration.ProgramTest(t, &test)

examples/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.17
55
require (
66
github.com/aws/aws-sdk-go v1.38.35
77
github.com/pulumi/pulumi/pkg/v3 v3.18.1
8+
github.com/pulumi/pulumi/sdk/v3 v3.18.0
89
github.com/stretchr/testify v1.7.0
910
)
1011

@@ -87,7 +88,6 @@ require (
8788
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
8889
github.com/pkg/errors v0.9.1 // indirect
8990
github.com/pmezard/go-difflib v1.0.0 // indirect
90-
github.com/pulumi/pulumi/sdk/v3 v3.18.0 // indirect
9191
github.com/rivo/uniseg v0.2.0 // indirect
9292
github.com/rjeczalik/notify v0.9.2 // indirect
9393
github.com/rogpeppe/go-internal v1.8.0 // indirect
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: command-simple-with-update
2+
runtime: nodejs
3+
description: test update field behavior
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const len = 10;
2+
export const fail = false;
3+
export const update = false;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as local from "@pulumi/command/local";
2+
import * as random from "@pulumi/random";
3+
import { interpolate } from "@pulumi/pulumi";
4+
import { len, fail, update } from "./extras";
5+
6+
const pw = new random.RandomPassword("pw", { length: len });
7+
8+
const pwd = new local.Command("pwd", {
9+
create: interpolate`touch "${pw.result}cat.txt"`,
10+
delete: interpolate`rm "${pw.result}dog.txt"`,
11+
triggers: [pw.result],
12+
})
13+
14+
export const output = pwd.stdout;

examples/simple-with-update/package-lock.json

Lines changed: 1993 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "command-typescript",
3+
"version": "0.1.0",
4+
"devDependencies": {
5+
"@types/node": "latest"
6+
},
7+
"dependencies": {
8+
"@pulumi/pulumi": "latest",
9+
"@pulumi/random": "^4.2.0"
10+
}
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"compilerOptions": {
3+
"strict": true,
4+
"outDir": "bin",
5+
"target": "es2016",
6+
"module": "commonjs",
7+
"moduleResolution": "node",
8+
"sourceMap": true,
9+
"experimentalDecorators": true,
10+
"pretty": true,
11+
"noFallthroughCasesInSwitch": true,
12+
"noImplicitReturns": true,
13+
"forceConsistentCasingInFileNames": true
14+
},
15+
"files": [
16+
"index.ts"
17+
]
18+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as local from "@pulumi/command/local";
2+
import * as random from "@pulumi/random";
3+
import { interpolate } from "@pulumi/pulumi";
4+
import { len, fail, update } from "./extras";
5+
6+
const pw = new random.RandomPassword("pw", { length: len });
7+
8+
const pwd = new local.Command("pwd", {
9+
create: interpolate`touch "${pw.result}cat.txt"`,
10+
update: interpolate`mv "${pw.result}cat.txt" "${pw.result}dog.txt"`,
11+
delete: interpolate`rm "${pw.result}dog.txt"`,
12+
triggers: [pw.result],
13+
})
14+
15+
export const output = pwd.stdout;

0 commit comments

Comments
 (0)