-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
11215: Test transpiled examples for all languages r=aq17 a=aq17 Cover all languages for examples synced from pulumi/yaml Co-authored-by: aq17 <aqiu@pulumi.com>
- Loading branch information
Showing
8 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
pkg/codegen/dotnet/gen_program_test/batchyaml/gen_program_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package batchyaml | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/pulumi/pulumi/pkg/v3/codegen" | ||
codegenDotnet "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet" | ||
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test" | ||
) | ||
|
||
// This specifically tests the synced examples from pulumi/yaml with | ||
// testing/test/testdata/transpiled_examples, as it requires a different SDK path in Check | ||
func TestGenerateProgram(t *testing.T) { | ||
t.Parallel() | ||
err := os.Chdir("../../../dotnet") // chdir into codegen/dotnet | ||
assert.Nil(t, err) | ||
|
||
test.TestProgramCodegen(t, | ||
test.ProgramCodegenOptions{ | ||
Language: "dotnet", | ||
Extension: "cs", | ||
OutputFile: "Program.cs", | ||
Check: func(t *testing.T, path string, dependencies codegen.StringSet) { | ||
codegenDotnet.Check(t, path, dependencies, "../../../../../../../sdk/dotnet/Pulumi") | ||
}, | ||
GenProgram: codegenDotnet.GenerateProgram, | ||
TestCases: test.PulumiPulumiYAMLProgramTests, | ||
}, | ||
) | ||
} |
2 changes: 1 addition & 1 deletion
2
...ogram_test/batch_yaml/gen_program_test.go → ...rogram_test/batchyaml/gen_program_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package batch7 | ||
package batchyaml | ||
|
||
import ( | ||
"os" | ||
|
32 changes: 32 additions & 0 deletions
32
pkg/codegen/nodejs/gen_program_test/batchyaml/gen_program_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package batchyaml | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/pulumi/pulumi/pkg/v3/codegen" | ||
codegenNode "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs" | ||
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test" | ||
) | ||
|
||
// This specifically tests the synced examples from pulumi/yaml with | ||
// testing/test/testdata/transpiled_examples | ||
func TestGenerateProgram(t *testing.T) { | ||
t.Parallel() | ||
err := os.Chdir("../../../nodejs") // chdir into codegen/nodejs | ||
assert.Nil(t, err) | ||
|
||
test.TestProgramCodegen(t, | ||
test.ProgramCodegenOptions{ | ||
Language: "nodejs", | ||
Extension: "ts", | ||
OutputFile: "index.ts", | ||
Check: func(t *testing.T, path string, dependencies codegen.StringSet) { | ||
codegenNode.Check(t, path, dependencies, true) | ||
}, | ||
GenProgram: codegenNode.GenerateProgram, | ||
TestCases: test.PulumiPulumiYAMLProgramTests, | ||
}) | ||
} |
29 changes: 29 additions & 0 deletions
29
pkg/codegen/python/gen_program_test/batchyaml/gen_program_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package batchyaml | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
codegenPy "github.com/pulumi/pulumi/pkg/v3/codegen/python" | ||
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test" | ||
) | ||
|
||
// This specifically tests the synced examples from pulumi/yaml with | ||
// testing/test/testdata/transpiled_examples | ||
func TestGenerateProgram(t *testing.T) { | ||
t.Parallel() | ||
err := os.Chdir("../../../python") // chdir into codegen/python | ||
assert.Nil(t, err) | ||
|
||
test.TestProgramCodegen(t, | ||
test.ProgramCodegenOptions{ | ||
Language: "python", | ||
Extension: "py", | ||
OutputFile: "__main__.py", | ||
Check: codegenPy.Check, | ||
GenProgram: codegenPy.GenerateProgram, | ||
TestCases: test.PulumiPulumiYAMLProgramTests, | ||
}) | ||
} |
14 changes: 14 additions & 0 deletions
14
pkg/codegen/testing/test/testdata/transpiled_examples/cue-random-pp/dotnet/dotnet.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Pulumi.Random" Version="4.2.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
14 changes: 14 additions & 0 deletions
14
...egen/testing/test/testdata/transpiled_examples/cue-static-web-app-pp/dotnet/dotnet.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Pulumi.AzureNative" Version="1.29.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
14 changes: 14 additions & 0 deletions
14
...codegen/testing/test/testdata/transpiled_examples/getting-started-pp/dotnet/dotnet.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Pulumi.Aws" Version="4.26.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
14 changes: 14 additions & 0 deletions
14
pkg/codegen/testing/test/testdata/transpiled_examples/random-pp/dotnet/dotnet.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Pulumi.Random" Version="4.2.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |