Skip to content

Commit 625fc1c

Browse files
authored
Enable more example tests (#750)
We weren't validating that example tests still run for Node/Dotnet/Python/Java. Python needs pulumi/providertest#150. Java still needs an example program but is less of a priority.
1 parent eddd398 commit 625fc1c

File tree

10 files changed

+39
-21
lines changed

10 files changed

+39
-21
lines changed

examples/dotnet/Program.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using System.Linq;
33
using Pulumi;
4-
using Boilerplate = Mynamespace.ProviderBoilerplate;
4+
using Boilerplate = Pulumi.ProviderBoilerplate;
55

66
return await Deployment.RunAsync(() =>
77
{
@@ -15,12 +15,6 @@
1515
Length = 24,
1616
});
1717

18-
return new Dictionary<string, object?>
19-
{
20-
["output"] =
21-
{
22-
{ "value", myRandomResource.Result },
23-
},
24-
};
18+
return new Dictionary<string, object?>{};
2519
});
2620

examples/dotnet_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@
33

44
package examples
55

6-
import "testing"
6+
import (
7+
"testing"
8+
9+
"github.com/pulumi/providertest/pulumitest"
10+
"github.com/pulumi/providertest/pulumitest/opttest"
11+
)
712

813
func TestDotnet(t *testing.T) {
9-
// TODO
14+
pt := pulumitest.NewPulumiTest(t, "dotnet",
15+
opttest.DotNetReference("Pulumi.ProviderBoilerplate", "../sdk/dotnet"),
16+
opttest.AttachProviderServer("provider-boilerplate", providerFactory),
17+
)
18+
19+
pt.Preview(t)
20+
pt.Up(t)
21+
pt.Destroy(t)
1022
}

examples/nodejs/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as pulumi from "@pulumi/pulumi";
2-
import * as boilerplate from "@mynamespace/provider-boilerplate";
2+
import * as boilerplate from "@pulumi/provider-boilerplate";
33

44
const myRandomResource = new boilerplate.Random("myRandomResource", {
55
length: 24,

examples/nodejs/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
},
66
"dependencies": {
77
"typescript": "^4.0.0",
8-
"@pulumi/pulumi": "3.207.0",
9-
"@mynamespace/provider-boilerplate": "1.0.0-alpha.0+dev"
8+
"@pulumi/pulumi": "3.207.0"
109
}
1110
}

examples/nodejs_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ import (
1111
)
1212

1313
func TestNodejsExampleLifecycle(t *testing.T) {
14-
t.Skip("linking isn't working correctly")
15-
1614
pt := pulumitest.NewPulumiTest(t, "nodejs",
17-
opttest.YarnLink("@mynamespace/provider-boilerplate"),
15+
opttest.YarnLink("@pulumi/provider-boilerplate"),
1816
opttest.AttachProviderServer("provider-boilerplate", providerFactory),
1917
)
2018

examples/python/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pulumi
2-
import provider_boilerplate as boilerplate
2+
import pulumi_provider_boilerplate as boilerplate
33

44
my_random_resource = boilerplate.Random("myRandomResource", length=24)
55
my_random_component = boilerplate.RandomComponent("myRandomComponent", length=24)

examples/python/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pulumi-provide-boilerplate==1.0.0
1+
pulumi_provide_boilerplate>=1.0.0
22
pulumi>=3.0.0,<4.0.0

examples/python_test.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@
33

44
package examples
55

6-
import "testing"
6+
import (
7+
"testing"
8+
9+
"github.com/pulumi/providertest/pulumitest"
10+
"github.com/pulumi/providertest/pulumitest/opttest"
11+
)
712

813
func TestPython(t *testing.T) {
9-
// TODO: https://github.com/pulumi/providertest/issues/39
14+
pt := pulumitest.NewPulumiTest(t, "python",
15+
opttest.SkipInstall(),
16+
opttest.PythonLink("../sdk/python"),
17+
opttest.AttachProviderServer("provider-boilerplate", providerFactory),
18+
)
19+
20+
pt.Preview(t)
21+
pt.Up(t)
22+
pt.Destroy(t)
1023
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toolchain go1.24.10
66

77
require (
88
github.com/blang/semver v3.5.1+incompatible
9-
github.com/pulumi/providertest v0.3.1
9+
github.com/pulumi/providertest v0.3.2-0.20251024161007-0fa5050ab7c9
1010
github.com/pulumi/pulumi-go-provider v1.1.2
1111
github.com/pulumi/pulumi-random/sdk/v4 v4.18.4
1212
github.com/pulumi/pulumi/sdk/v3 v3.206.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+Sob
181181
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
182182
github.com/pulumi/providertest v0.3.1 h1:vlftr7TZlObh81mL88IhhF0/9ZbLrZZos4NAvR4HUUw=
183183
github.com/pulumi/providertest v0.3.1/go.mod h1:fFHUP4/9DRyYnHWiRnwcynMtM/a7hHR/QcJfcuZKO3A=
184+
github.com/pulumi/providertest v0.3.2-0.20251024161007-0fa5050ab7c9 h1:MecwPUe14foKgjw3OiQw0CXLuVCm4oICbEty2PjYJGw=
185+
github.com/pulumi/providertest v0.3.2-0.20251024161007-0fa5050ab7c9/go.mod h1:OBpIGSQrw1FW9VNaHBtKCRxEoTISvx8JsxECmRqRgRQ=
184186
github.com/pulumi/pulumi-go-provider v1.1.2 h1:NUQDXaftBDFTPMBPwxo8FhJUX0ymkv6a1XiXTnCDpvg=
185187
github.com/pulumi/pulumi-go-provider v1.1.2/go.mod h1:3lNIuxT/BArFyiKrVfv+UT7gMMtplss7V69KuBZ4zIk=
186188
github.com/pulumi/pulumi-random/sdk/v4 v4.18.4 h1:mkZ3nB3xLTFZ8Fbh50bXTxiroGpjSyonTFcKovLxWME=

0 commit comments

Comments
 (0)