fix(ci): Split programgen tests over more jobs

This commit is contained in:
Aaron Friel 2022-10-16 22:56:57 -07:00
parent 2950ab7e0b
commit abb3763229
36 changed files with 898 additions and 91 deletions

View File

@ -121,10 +121,9 @@ jobs:
--kind unit-test \
--platform ubuntu-latest \
--version-set current \
--partition-module pkg 3 \
--partition-module pkg 7 \
--partition-module sdk 1 \
--partition-module tests 2 \
--partition-package github.com/pulumi/pulumi/pkg/v3/codegen/nodejs pkg/codegen/nodejs 4
--partition-module tests 2
)
INTEGRATION_TEST_MATRIX=$(

View File

@ -7,23 +7,6 @@ import (
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
t.Parallel()
test.TestProgramCodegen(t,
test.ProgramCodegenOptions{
Language: "dotnet",
Extension: "cs",
OutputFile: "Program.cs",
Check: func(t *testing.T, path string, dependencies codegen.StringSet) {
Check(t, path, dependencies, "../../../../../../../sdk/dotnet/Pulumi")
},
GenProgram: GenerateProgram,
TestCases: test.PulumiPulumiProgramTests,
},
)
}
func TestGenerateProgramVersionSelection(t *testing.T) {
t.Parallel()

View File

@ -126,3 +126,18 @@ func dotnetDependencies(deps codegen.StringSet) []dep {
}
return result
}
func GenerateProgramBatchTest(t *testing.T, testCases []test.ProgramTest) {
test.TestProgramCodegen(t,
test.ProgramCodegenOptions{
Language: "dotnet",
Extension: "cs",
OutputFile: "Program.cs",
Check: func(t *testing.T, path string, dependencies codegen.StringSet) {
Check(t, path, dependencies, "../../../../../../../sdk/dotnet/Pulumi")
},
GenProgram: GenerateProgram,
TestCases: testCases,
},
)
}

View File

@ -21,25 +21,6 @@ import (
var testdataPath = filepath.Join("..", "testing", "test", "testdata")
func TestGenerateProgram(t *testing.T) {
t.Parallel()
test.TestProgramCodegen(t,
test.ProgramCodegenOptions{
Language: "go",
Extension: "go",
OutputFile: "main.go",
Check: func(t *testing.T, path string, dependencies codegen.StringSet) {
Check(t, path, dependencies, "../../../../../../../sdk")
},
GenProgram: func(program *pcl.Program) (map[string][]byte, hcl.Diagnostics, error) {
// Prevent tests from interfering with each other
return GenerateProgramWithOptions(program, GenerateProgramOptions{ExternalCache: NewCache()})
},
TestCases: test.PulumiPulumiProgramTests,
})
}
func TestGenerateProgramVersionSelection(t *testing.T) {
t.Parallel()

View File

@ -6,10 +6,13 @@ import (
"path/filepath"
"testing"
"github.com/hashicorp/hcl/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/pulumi/pulumi/pkg/v3/codegen"
"github.com/pulumi/pulumi/pkg/v3/codegen/pcl"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
"github.com/pulumi/pulumi/pkg/v3/testing/integration"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/executable"
)
@ -60,3 +63,20 @@ func TypeCheck(t *testing.T, path string, deps codegen.StringSet, pulumiSDKPath
os.Remove(filepath.Join(dir, "main"))
assert.NoError(t, err)
}
func GenerateProgramBatchTest(t *testing.T, testCases []test.ProgramTest) {
test.TestProgramCodegen(t,
test.ProgramCodegenOptions{
Language: "go",
Extension: "go",
OutputFile: "main.go",
Check: func(t *testing.T, path string, dependencies codegen.StringSet) {
Check(t, path, dependencies, "../../../../../../../sdk")
},
GenProgram: func(program *pcl.Program) (map[string][]byte, hcl.Diagnostics, error) {
// Prevent tests from interfering with each other
return GenerateProgramWithOptions(program, GenerateProgramOptions{ExternalCache: NewCache()})
},
TestCases: testCases,
})
}

View File

@ -7,42 +7,6 @@ import (
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
// For better CI test to job distribution, we split the test cases into three tests.
var genProgramBatchSize = len(test.PulumiPulumiProgramTests) / 3
func TestGenerateProgramOne(t *testing.T) {
t.Parallel()
testGenerateProgramBatch(t, test.PulumiPulumiProgramTests[0:genProgramBatchSize])
}
func TestGenerateProgramTwo(t *testing.T) {
t.Parallel()
testGenerateProgramBatch(t, test.PulumiPulumiProgramTests[genProgramBatchSize:2*genProgramBatchSize])
}
func TestGenerateProgramThree(t *testing.T) {
t.Parallel()
testGenerateProgramBatch(t, test.PulumiPulumiProgramTests[2*genProgramBatchSize:])
}
func testGenerateProgramBatch(t *testing.T, testCases []test.ProgramTest) {
test.TestProgramCodegen(t,
test.ProgramCodegenOptions{
Language: "nodejs",
Extension: "ts",
OutputFile: "index.ts",
Check: func(t *testing.T, path string, dependencies codegen.StringSet) {
Check(t, path, dependencies, true)
},
GenProgram: GenerateProgram,
TestCases: testCases,
})
}
func TestGenerateProgramVersionSelection(t *testing.T) {
t.Parallel()

View File

@ -109,3 +109,17 @@ func nodejsPackages(t *testing.T, deps codegen.StringSet) map[string]string {
}
return result
}
func GenerateProgramBatchTest(t *testing.T, testCases []test.ProgramTest) {
test.TestProgramCodegen(t,
test.ProgramCodegenOptions{
Language: "nodejs",
Extension: "ts",
OutputFile: "index.ts",
Check: func(t *testing.T, path string, dependencies codegen.StringSet) {
Check(t, path, dependencies, true)
},
GenProgram: GenerateProgram,
TestCases: testCases,
})
}

View File

@ -1,32 +1,19 @@
package python
import (
"path/filepath"
"testing"
"github.com/pulumi/pulumi/pkg/v3/codegen/hcl2/model"
"github.com/pulumi/pulumi/pkg/v3/codegen/pcl"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
"github.com/stretchr/testify/assert"
"path/filepath"
"testing"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
var testdataPath = filepath.Join("..", "testing", "test", "testdata")
func TestGenerateProgram(t *testing.T) {
t.Parallel()
test.TestProgramCodegen(t,
test.ProgramCodegenOptions{
Language: "python",
Extension: "py",
OutputFile: "__main__.py",
Check: Check,
GenProgram: GenerateProgram,
TestCases: test.PulumiPulumiProgramTests,
})
}
func TestFunctionInvokeBindsArgumentObjectType(t *testing.T) {
t.Parallel()

View File

@ -42,3 +42,15 @@ func pyCompileCheck(t *testing.T, codeDir string) {
args := append([]string{"-m", "py_compile"}, pythonFiles...)
test.RunCommand(t, "python syntax check", codeDir, ex, args...)
}
func GenerateProgramBatchTest(t *testing.T, testCases []test.ProgramTest) {
test.TestProgramCodegen(t,
test.ProgramCodegenOptions{
Language: "python",
Extension: "py",
OutputFile: "__main__.py",
Check: Check,
GenProgram: GenerateProgram,
TestCases: testCases,
})
}

View File

@ -0,0 +1,80 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:generate go run ./generate.go
package main
import (
"fmt"
"os"
"path"
)
// Split codegen tests into separate packages to extract greater parallelism, breaking up the
// slowest set(s) of tests.
func main() {
template := `// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package %s
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/%s"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../%[2]s") // chdir into codegen/%[2]s
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(%d, %d))
}`
os.RemoveAll("../codegen")
n := 6
for _, lang := range []string{"dotnet", "go", "nodejs", "python"} {
for i := 1; i <= n; i++ {
packageName := fmt.Sprintf("%s%dof%d", lang, i, n)
dir := path.Join("../codegen", packageName)
err := os.MkdirAll(dir, 0755)
if err != nil {
panic(fmt.Sprintf("unexpected error generating codegen tests: %v", err))
}
testPath := path.Join(dir, "gen_program_test.go")
sourceCode := fmt.Sprintf(template, packageName, lang, i, n)
err = os.WriteFile(testPath, []byte(sourceCode), 0755) //nolint:gosec
if err != nil {
panic(fmt.Sprintf("unexpected error generating codegen tests: %v", err))
}
}
}
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package dotnet1of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../dotnet") // chdir into codegen/dotnet
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(1, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package dotnet2of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../dotnet") // chdir into codegen/dotnet
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(2, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package dotnet3of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../dotnet") // chdir into codegen/dotnet
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(3, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package dotnet4of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../dotnet") // chdir into codegen/dotnet
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(4, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package dotnet5of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../dotnet") // chdir into codegen/dotnet
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(5, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package dotnet6of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../dotnet") // chdir into codegen/dotnet
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(6, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package go1of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/go"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../go") // chdir into codegen/go
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(1, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package go2of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/go"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../go") // chdir into codegen/go
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(2, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package go3of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/go"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../go") // chdir into codegen/go
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(3, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package go4of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/go"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../go") // chdir into codegen/go
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(4, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package go5of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/go"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../go") // chdir into codegen/go
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(5, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package go6of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/go"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../go") // chdir into codegen/go
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(6, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package nodejs1of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../nodejs") // chdir into codegen/nodejs
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(1, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package nodejs2of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../nodejs") // chdir into codegen/nodejs
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(2, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package nodejs3of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../nodejs") // chdir into codegen/nodejs
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(3, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package nodejs4of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../nodejs") // chdir into codegen/nodejs
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(4, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package nodejs5of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../nodejs") // chdir into codegen/nodejs
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(5, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package nodejs6of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../nodejs") // chdir into codegen/nodejs
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(6, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package python1of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/python"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../python") // chdir into codegen/python
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(1, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package python2of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/python"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../python") // chdir into codegen/python
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(2, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package python3of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/python"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../python") // chdir into codegen/python
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(3, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package python4of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/python"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../python") // chdir into codegen/python
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(4, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package python5of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/python"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../python") // chdir into codegen/python
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(5, 6))
}

View File

@ -0,0 +1,30 @@
// Copyright 2016-2022, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by "../codegen-generator/generate.go"; DO NOT EDIT.
package python6of6
import (
"os"
"testing"
codegen "github.com/pulumi/pulumi/pkg/v3/codegen/python"
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/test"
)
func TestGenerateProgram(t *testing.T) {
os.Chdir("../../../python") // chdir into codegen/python
codegen.GenerateProgramBatchTest(t, test.ProgramTestBatch(6, 6))
}

View File

@ -39,6 +39,13 @@ type ProgramTest struct {
var testdataPath = filepath.Join("..", "testing", "test", "testdata")
// Get batch number k (base-1 indexed) of tests out of n batches total.
func ProgramTestBatch(k, n int) []ProgramTest {
start := ((k - 1) * len(PulumiPulumiProgramTests)) / n
end := ((k) * len(PulumiPulumiProgramTests)) / n
return PulumiPulumiProgramTests[start:end]
}
var PulumiPulumiProgramTests = []ProgramTest{
{
Directory: "assets-archives",

View File

@ -0,0 +1,25 @@
package test
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestBatches(t *testing.T) {
t.Parallel()
for _, n := range []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} {
n := n
t.Run(fmt.Sprintf("%d", n), func(t *testing.T) {
t.Parallel()
var combined []ProgramTest
for i := 1; i <= n; i++ {
combined = append(combined, ProgramTestBatch(i, n)...)
}
assert.ElementsMatch(t, PulumiPulumiProgramTests, combined)
})
}
}