2024-09-09 12:05:45 +00:00
|
|
|
// Copyright 2021-2024, 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.
|
|
|
|
|
2021-07-28 01:00:39 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
2022-07-20 22:12:02 +00:00
|
|
|
"bufio"
|
2021-07-28 01:00:39 +00:00
|
|
|
"bytes"
|
2022-10-10 23:01:53 +00:00
|
|
|
"fmt"
|
|
|
|
"io"
|
2021-07-28 01:00:39 +00:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2022-01-08 03:27:14 +00:00
|
|
|
"runtime"
|
2021-07-28 01:00:39 +00:00
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
2024-05-30 19:51:12 +00:00
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
|
|
|
|
|
2022-07-20 22:12:02 +00:00
|
|
|
"github.com/blang/semver"
|
2021-07-28 01:00:39 +00:00
|
|
|
"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/hcl2/syntax"
|
2021-09-30 03:11:56 +00:00
|
|
|
"github.com/pulumi/pulumi/pkg/v3/codegen/pcl"
|
2022-02-07 11:10:04 +00:00
|
|
|
"github.com/pulumi/pulumi/pkg/v3/codegen/testing/utils"
|
2022-01-31 20:48:32 +00:00
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil"
|
2022-07-20 22:12:02 +00:00
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/workspace"
|
2021-07-28 01:00:39 +00:00
|
|
|
)
|
|
|
|
|
2022-10-20 20:37:10 +00:00
|
|
|
const (
|
|
|
|
transpiledExamplesDir = "transpiled_examples"
|
|
|
|
)
|
|
|
|
|
|
|
|
func transpiled(dir string) string {
|
|
|
|
return filepath.Join(transpiledExamplesDir, dir)
|
|
|
|
}
|
|
|
|
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
var allProgLanguages = codegen.NewStringSet(TestDotnet, TestPython, TestGo, TestNodeJS)
|
2022-01-31 20:48:32 +00:00
|
|
|
|
2022-02-07 11:10:04 +00:00
|
|
|
type ProgramTest struct {
|
2022-10-11 10:56:29 +00:00
|
|
|
Directory string
|
|
|
|
Description string
|
|
|
|
Skip codegen.StringSet
|
|
|
|
ExpectNYIDiags codegen.StringSet
|
|
|
|
SkipCompile codegen.StringSet
|
2022-10-10 23:01:53 +00:00
|
|
|
BindOptions []pcl.BindOption
|
2022-10-11 10:56:29 +00:00
|
|
|
MockPluginVersions map[string]string
|
2024-05-30 19:51:12 +00:00
|
|
|
PluginHost plugin.Host
|
2021-07-28 01:00:39 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 11:10:04 +00:00
|
|
|
var testdataPath = filepath.Join("..", "testing", "test", "testdata")
|
2021-07-28 01:00:39 +00:00
|
|
|
|
2022-10-17 05:56:57 +00:00
|
|
|
// 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]
|
|
|
|
}
|
|
|
|
|
2023-07-28 18:30:00 +00:00
|
|
|
// Useful when debugging a single test case.
|
|
|
|
func SingleTestCase(directoryName string) []ProgramTest {
|
|
|
|
output := make([]ProgramTest, 0)
|
|
|
|
for _, t := range PulumiPulumiProgramTests {
|
|
|
|
if t.Directory == directoryName {
|
|
|
|
output = append(output, t)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return output
|
|
|
|
}
|
|
|
|
|
2022-02-07 11:10:04 +00:00
|
|
|
var PulumiPulumiProgramTests = []ProgramTest{
|
2022-04-25 19:59:30 +00:00
|
|
|
{
|
|
|
|
Directory: "assets-archives",
|
|
|
|
Description: "Assets and archives",
|
|
|
|
},
|
2022-05-20 17:29:05 +00:00
|
|
|
{
|
|
|
|
Directory: "synthetic-resource-properties",
|
|
|
|
Description: "Synthetic resource properties",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestNodeJS, TestDotnet, TestGo), // not a real package
|
2022-05-20 17:29:05 +00:00
|
|
|
},
|
2021-07-28 01:00:39 +00:00
|
|
|
{
|
2024-08-16 08:14:13 +00:00
|
|
|
Directory: "aws-s3-folder",
|
|
|
|
Description: "AWS S3 Folder",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo),
|
2021-09-29 18:33:57 +00:00
|
|
|
// Blocked on go:
|
|
|
|
// TODO[pulumi/pulumi#8064]
|
|
|
|
// TODO[pulumi/pulumi#8065]
|
2021-07-28 01:00:39 +00:00
|
|
|
},
|
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "aws-eks",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "AWS EKS",
|
|
|
|
},
|
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "aws-fargate",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "AWS Fargate",
|
|
|
|
},
|
2024-03-10 17:23:15 +00:00
|
|
|
{
|
|
|
|
Directory: "aws-static-website",
|
|
|
|
Description: "an example resource from AWS static website multi-language component",
|
|
|
|
// TODO: blocked on resolving imports (python) / using statements (C#) for types from external packages
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestDotnet, TestPython),
|
2024-03-10 17:23:15 +00:00
|
|
|
},
|
2023-06-23 00:42:18 +00:00
|
|
|
{
|
|
|
|
Directory: "aws-fargate-output-versioned",
|
|
|
|
Description: "AWS Fargate Using Output-versioned invokes for python and typescript",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestDotnet),
|
2023-06-23 00:42:18 +00:00
|
|
|
BindOptions: []pcl.BindOption{pcl.PreferOutputVersionedInvokes},
|
|
|
|
},
|
2021-07-28 01:00:39 +00:00
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "aws-s3-logging",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "AWS S3 with logging",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo),
|
2021-09-29 18:33:57 +00:00
|
|
|
// Blocked on nodejs: TODO[pulumi/pulumi#8068]
|
2021-11-15 20:17:20 +00:00
|
|
|
// Flaky in go: TODO[pulumi/pulumi#8123]
|
2021-07-28 01:00:39 +00:00
|
|
|
},
|
2022-07-06 13:27:17 +00:00
|
|
|
{
|
|
|
|
Directory: "aws-iam-policy",
|
|
|
|
Description: "AWS IAM Policy",
|
|
|
|
},
|
2023-11-23 00:26:41 +00:00
|
|
|
{
|
|
|
|
Directory: "read-file-func",
|
|
|
|
Description: "ReadFile function translation works",
|
|
|
|
},
|
2022-10-06 17:02:30 +00:00
|
|
|
{
|
|
|
|
Directory: "python-regress-10914",
|
|
|
|
Description: "Python regression test for #10914",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestPython),
|
2022-10-06 17:02:30 +00:00
|
|
|
},
|
2023-01-11 22:17:14 +00:00
|
|
|
{
|
|
|
|
Directory: "simplified-invokes",
|
|
|
|
Description: "Simplified invokes",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestPython, TestGo),
|
|
|
|
SkipCompile: codegen.NewStringSet(TestDotnet, TestNodeJS),
|
2023-01-11 22:17:14 +00:00
|
|
|
},
|
[codegen/go] Improve optional params in invoke
As described in #8821, docs generated for helper functions can be incorrect because optional arguments to parameter objects are not correctly handled.
Previously, code would be generated like so:
```go
policyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
iam.GetPolicyDocumentStatement{
Sid: "1",
//...
```
However "Sid" is of type `*string`.
This four helper conversion functions, to handle the primitive types we lower from, and modifies codegen to recursively apply these functions inside of an invoke call.
In the new code generation, the above is instead rendered as:
```go
policyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
iam.GetPolicyDocumentStatement{
Sid: pulumi.StringRef("1"),
//...
```
2022-02-01 03:18:15 +00:00
|
|
|
{
|
|
|
|
Directory: "aws-optionals",
|
|
|
|
Description: "AWS get invoke with nested object constructor that takes an optional string",
|
2022-02-01 09:34:29 +00:00
|
|
|
// Testing Go behavior exclusively:
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestGo),
|
[codegen/go] Improve optional params in invoke
As described in #8821, docs generated for helper functions can be incorrect because optional arguments to parameter objects are not correctly handled.
Previously, code would be generated like so:
```go
policyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
iam.GetPolicyDocumentStatement{
Sid: "1",
//...
```
However "Sid" is of type `*string`.
This four helper conversion functions, to handle the primitive types we lower from, and modifies codegen to recursively apply these functions inside of an invoke call.
In the new code generation, the above is instead rendered as:
```go
policyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
iam.GetPolicyDocumentStatement{
Sid: pulumi.StringRef("1"),
//...
```
2022-02-01 03:18:15 +00:00
|
|
|
},
|
2021-07-28 01:00:39 +00:00
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "aws-webserver",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "AWS Webserver",
|
|
|
|
},
|
2022-10-09 16:28:49 +00:00
|
|
|
{
|
|
|
|
Directory: "simple-range",
|
|
|
|
Description: "Simple range as int expression translation",
|
|
|
|
},
|
2021-07-28 01:00:39 +00:00
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "azure-native",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "Azure Native",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo, TestDotnet),
|
2021-09-29 18:33:57 +00:00
|
|
|
// Blocked on go:
|
|
|
|
// TODO[pulumi/pulumi#8073]
|
|
|
|
// TODO[pulumi/pulumi#8074]
|
2021-07-28 01:00:39 +00:00
|
|
|
},
|
2024-05-30 19:51:12 +00:00
|
|
|
{
|
|
|
|
Directory: "azure-native-v2-eventgrid",
|
|
|
|
Description: "Azure Native V2 basic example to ensure that importPathPatten works",
|
|
|
|
// Specifically use a simplified azure-native v2.x schema when testing this program
|
|
|
|
// this schema only contains content from the eventgrid module which is sufficient to test with
|
|
|
|
PluginHost: utils.NewHostWithProviders(testdataPath,
|
|
|
|
utils.NewSchemaProvider("azure-native", "2.41.0")),
|
|
|
|
},
|
2021-07-28 01:00:39 +00:00
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "azure-sa",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "Azure SA",
|
|
|
|
},
|
[program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696)
# Description
This PR improves enum type resolution from strings. When we try to
resolve `Union[string, Enum]` for a string expression, we choose
`string` because it is the more general type since not every string is
assignable to `Enum`. However, here we spacial case strings that are
actually part of that `Enum`.
The result is that `pcl.LowerConversion` will choose `Enum` from
`Union[string, Enum]` when the value of the input string is compatible
with the enum. This greatly improves program-gen for all of typescript,
python, csharp and go which now will emit the fully qualified enum cases
instead of emitting strings.
Closes https://github.com/pulumi/pulumi-dotnet/issues/41 which is
supposed to be a duplicate of
https://github.com/pulumi/pulumi-azure-native/issues/2616 but that is
not the case (the former is about unions of objects, the latter is
unions of enums and strings)
## Checklist
- [ ] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [x] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2024-03-15 17:49:12 +00:00
|
|
|
{
|
|
|
|
Directory: "string-enum-union-list",
|
|
|
|
Description: "Contains resource which has a property of type List<Union<String, Enum>>",
|
|
|
|
// skipping compiling on Go because it doesn't know to handle unions in lists
|
|
|
|
// and instead generates pulumi.StringArray
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo),
|
[program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696)
# Description
This PR improves enum type resolution from strings. When we try to
resolve `Union[string, Enum]` for a string expression, we choose
`string` because it is the more general type since not every string is
assignable to `Enum`. However, here we spacial case strings that are
actually part of that `Enum`.
The result is that `pcl.LowerConversion` will choose `Enum` from
`Union[string, Enum]` when the value of the input string is compatible
with the enum. This greatly improves program-gen for all of typescript,
python, csharp and go which now will emit the fully qualified enum cases
instead of emitting strings.
Closes https://github.com/pulumi/pulumi-dotnet/issues/41 which is
supposed to be a duplicate of
https://github.com/pulumi/pulumi-azure-native/issues/2616 but that is
not the case (the former is about unions of objects, the latter is
unions of enums and strings)
## Checklist
- [ ] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [x] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2024-03-15 17:49:12 +00:00
|
|
|
},
|
2024-03-24 00:06:57 +00:00
|
|
|
{
|
|
|
|
Directory: "using-object-as-input-for-any",
|
|
|
|
Description: "Tests using object as input for a property of type 'any'",
|
|
|
|
},
|
2021-07-28 01:00:39 +00:00
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "kubernetes-operator",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "K8s Operator",
|
|
|
|
},
|
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "kubernetes-pod",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "K8s Pod",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo),
|
2021-09-29 18:33:57 +00:00
|
|
|
// Blocked on go:
|
|
|
|
// TODO[pulumi/pulumi#8073]
|
|
|
|
// TODO[pulumi/pulumi#8074]
|
2021-07-28 01:00:39 +00:00
|
|
|
},
|
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "kubernetes-template",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "K8s Template",
|
|
|
|
},
|
2023-12-27 12:42:52 +00:00
|
|
|
{
|
|
|
|
Directory: "kubernetes-template-quoted",
|
|
|
|
Description: "K8s Template with quoted string property keys to ensure that resource binding works here",
|
|
|
|
},
|
2021-07-28 01:00:39 +00:00
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "random-pet",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "Random Pet",
|
|
|
|
},
|
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "aws-secret",
|
2021-07-28 01:00:39 +00:00
|
|
|
Description: "Secret",
|
|
|
|
},
|
2021-07-29 03:41:23 +00:00
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "functions",
|
2021-07-29 03:41:23 +00:00
|
|
|
Description: "Functions",
|
|
|
|
},
|
2021-11-17 20:27:50 +00:00
|
|
|
{
|
2022-01-31 20:48:32 +00:00
|
|
|
Directory: "output-funcs-aws",
|
2021-11-17 20:27:50 +00:00
|
|
|
Description: "Output Versioned Functions",
|
|
|
|
},
|
2022-01-31 20:48:32 +00:00
|
|
|
{
|
|
|
|
Directory: "third-party-package",
|
|
|
|
Description: "Ensuring correct imports for third party packages",
|
|
|
|
// compiling and type checking involves downloading the real package to
|
|
|
|
// check against. Because we are checking against the "other" package
|
|
|
|
// (which doesn't exist), this does not work.
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestNodeJS, TestDotnet, TestGo),
|
2022-01-31 20:48:32 +00:00
|
|
|
},
|
2022-02-08 13:45:24 +00:00
|
|
|
{
|
|
|
|
Directory: "invalid-go-sprintf",
|
|
|
|
Description: "Regress invalid Go",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestPython, TestNodeJS, TestDotnet),
|
2022-02-08 13:45:24 +00:00
|
|
|
},
|
2022-04-07 10:00:19 +00:00
|
|
|
{
|
2022-04-18 09:03:42 +00:00
|
|
|
Directory: "typed-enum",
|
|
|
|
Description: "Supply strongly typed enums",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo),
|
2022-04-18 09:03:42 +00:00
|
|
|
},
|
2022-08-19 17:27:05 +00:00
|
|
|
{
|
|
|
|
Directory: "pulumi-stack-reference",
|
|
|
|
Description: "StackReference as resource",
|
|
|
|
},
|
2022-04-18 09:03:42 +00:00
|
|
|
{
|
2022-04-07 10:00:19 +00:00
|
|
|
Directory: "python-resource-names",
|
|
|
|
Description: "Repro for #9357",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),
|
2022-04-07 10:00:19 +00:00
|
|
|
},
|
2022-04-25 22:07:25 +00:00
|
|
|
{
|
|
|
|
Directory: "logical-name",
|
|
|
|
Description: "Logical names",
|
|
|
|
},
|
2022-07-13 16:06:00 +00:00
|
|
|
{
|
|
|
|
Directory: "aws-lambda",
|
|
|
|
Description: "AWS Lambdas",
|
|
|
|
// We have special testing for this case because lambda is a python keyword.
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),
|
2022-07-13 16:06:00 +00:00
|
|
|
},
|
2022-09-14 04:18:07 +00:00
|
|
|
{
|
2024-03-28 10:49:27 +00:00
|
|
|
Directory: "basic-unions",
|
|
|
|
Description: "Tests program generation of fields of type union",
|
|
|
|
SkipCompile: allProgLanguages, // because the schema is synthetic
|
2022-09-14 04:18:07 +00:00
|
|
|
},
|
2022-11-15 01:00:09 +00:00
|
|
|
{
|
|
|
|
Directory: "traverse-union-repro",
|
|
|
|
Description: `Handling the error "cannot traverse value of type union(...)"`,
|
|
|
|
BindOptions: []pcl.BindOption{
|
|
|
|
pcl.SkipResourceTypechecking,
|
|
|
|
pcl.AllowMissingVariables,
|
|
|
|
pcl.AllowMissingProperties,
|
|
|
|
},
|
|
|
|
// The example is known to be invalid. Specifically it hands a
|
|
|
|
// `[aws_subnet.test1.id]` to a `string` attribute, where `aws_subnet` is not in
|
|
|
|
// scope.
|
|
|
|
//
|
|
|
|
// The example is invalid in two ways:
|
|
|
|
// 1. `aws_subnet` is a missing variable.
|
|
|
|
// 2. `[...]` is a tuple, which can never be a string.
|
|
|
|
//
|
|
|
|
// Even though the generated code will not type check, it should still be
|
|
|
|
// directionally correct.
|
|
|
|
SkipCompile: allProgLanguages,
|
|
|
|
},
|
2023-03-08 13:21:34 +00:00
|
|
|
{
|
|
|
|
Directory: "components",
|
|
|
|
Description: "Components",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo),
|
2023-03-08 13:21:34 +00:00
|
|
|
},
|
2023-04-05 11:04:46 +00:00
|
|
|
{
|
|
|
|
Directory: "entries-function",
|
|
|
|
Description: "Using the entries function",
|
2023-06-02 14:59:46 +00:00
|
|
|
// go and dotnet do fully not support GenForExpression yet
|
2023-04-05 11:04:46 +00:00
|
|
|
// Todo: https://github.com/pulumi/pulumi/issues/12606
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: allProgLanguages.Except(TestNodeJS).Except(TestPython),
|
2023-04-05 11:04:46 +00:00
|
|
|
},
|
2023-02-28 20:50:51 +00:00
|
|
|
{
|
|
|
|
Directory: "retain-on-delete",
|
|
|
|
Description: "Generate RetainOnDelete option",
|
|
|
|
},
|
2024-03-25 15:34:54 +00:00
|
|
|
{
|
|
|
|
Directory: "depends-on-array",
|
|
|
|
Description: "Using DependsOn resource option with an array of resources",
|
|
|
|
},
|
2023-06-22 17:43:06 +00:00
|
|
|
{
|
|
|
|
Directory: "multiline-string",
|
|
|
|
Description: "Multiline string literals",
|
|
|
|
},
|
2023-12-20 13:16:37 +00:00
|
|
|
{
|
|
|
|
Directory: "config-variables",
|
|
|
|
Description: "Basic program with a bunch of config variables",
|
|
|
|
// TODO[https://github.com/pulumi/pulumi/issues/14957] - object config variables are broken here
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo, TestDotnet),
|
2023-12-20 13:16:37 +00:00
|
|
|
},
|
2023-06-23 17:38:13 +00:00
|
|
|
{
|
|
|
|
Directory: "regress-11176",
|
|
|
|
Description: "Regression test for https://github.com/pulumi/pulumi/issues/11176",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestGo),
|
2023-06-23 17:38:13 +00:00
|
|
|
},
|
2023-03-10 11:14:28 +00:00
|
|
|
{
|
|
|
|
Directory: "throw-not-implemented",
|
2023-03-10 11:28:23 +00:00
|
|
|
Description: "Function notImplemented is compiled to a runtime error at call-site",
|
2023-03-10 11:14:28 +00:00
|
|
|
},
|
2023-03-16 14:41:04 +00:00
|
|
|
{
|
|
|
|
Directory: "python-reserved",
|
|
|
|
Description: "Test python reserved words aren't used",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestPython),
|
2023-03-16 14:41:04 +00:00
|
|
|
},
|
2023-04-21 10:18:23 +00:00
|
|
|
{
|
|
|
|
Directory: "iterating-optional-range-expressions",
|
|
|
|
Description: "Test that we can iterate over range expression that are option(iterator)",
|
2023-05-02 14:07:58 +00:00
|
|
|
// TODO: dotnet and go
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestNodeJS).Except(TestPython),
|
2023-04-26 18:00:32 +00:00
|
|
|
// We are using a synthetic schema defined in range-1.0.0.json so we can't compile all the way
|
|
|
|
SkipCompile: allProgLanguages,
|
2023-04-21 10:18:23 +00:00
|
|
|
},
|
2023-05-12 09:31:32 +00:00
|
|
|
{
|
|
|
|
Directory: "output-literals",
|
|
|
|
Description: "Tests that we can return various literal values via stack outputs",
|
|
|
|
},
|
2023-05-16 18:11:57 +00:00
|
|
|
{
|
|
|
|
Directory: "dynamic-entries",
|
|
|
|
Description: "Testing iteration of dynamic entries in TypeScript",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestNodeJS),
|
2023-05-16 19:33:14 +00:00
|
|
|
SkipCompile: allProgLanguages,
|
2023-05-16 18:11:57 +00:00
|
|
|
},
|
2023-05-25 20:12:13 +00:00
|
|
|
{
|
|
|
|
Directory: "single-or-none",
|
|
|
|
Description: "Tests using the singleOrNone function",
|
|
|
|
},
|
2023-06-07 11:22:41 +00:00
|
|
|
{
|
|
|
|
Directory: "simple-splat",
|
|
|
|
Description: "An example that shows we can compile splat expressions from array of objects",
|
|
|
|
// Skip compiling because we are using a test schema without a corresponding real package
|
|
|
|
SkipCompile: allProgLanguages,
|
|
|
|
},
|
2023-06-02 16:33:18 +00:00
|
|
|
{
|
|
|
|
Directory: "invoke-inside-conditional-range",
|
|
|
|
Description: "Using the result of an invoke inside a conditional range expression of a resource",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestNodeJS).Except(TestDotnet),
|
2023-06-03 00:02:42 +00:00
|
|
|
SkipCompile: allProgLanguages,
|
2023-06-02 16:33:18 +00:00
|
|
|
},
|
2023-06-07 00:37:40 +00:00
|
|
|
{
|
|
|
|
Directory: "output-name-conflict",
|
|
|
|
Description: "Tests whether we are able to generate programs where output variables have same id as config var",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo),
|
2023-06-07 00:37:40 +00:00
|
|
|
},
|
2023-06-08 23:44:09 +00:00
|
|
|
{
|
|
|
|
Directory: "snowflake-python-12998",
|
|
|
|
Description: "Tests regression for issue https://github.com/pulumi/pulumi/issues/12998",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestPython),
|
2023-06-08 23:44:09 +00:00
|
|
|
SkipCompile: allProgLanguages,
|
|
|
|
BindOptions: []pcl.BindOption{pcl.AllowMissingVariables, pcl.AllowMissingProperties},
|
|
|
|
},
|
2023-06-14 17:02:56 +00:00
|
|
|
{
|
|
|
|
Directory: "unknown-resource",
|
|
|
|
Description: "Tests generating code for unknown resources when skipping resource type-checking",
|
|
|
|
SkipCompile: allProgLanguages,
|
|
|
|
BindOptions: []pcl.BindOption{pcl.SkipResourceTypechecking},
|
|
|
|
},
|
2023-06-20 16:11:47 +00:00
|
|
|
{
|
|
|
|
Directory: "using-dashes",
|
|
|
|
Description: "Test program generation on packages with a dash in the name",
|
|
|
|
SkipCompile: allProgLanguages, // since we are using a synthetic schema
|
|
|
|
},
|
2023-07-10 13:05:18 +00:00
|
|
|
{
|
|
|
|
Directory: "unknown-invoke",
|
|
|
|
Description: "Tests generating code for unknown invokes when skipping invoke type checking",
|
|
|
|
SkipCompile: allProgLanguages,
|
|
|
|
BindOptions: []pcl.BindOption{pcl.SkipInvokeTypechecking},
|
|
|
|
},
|
2023-07-14 22:15:28 +00:00
|
|
|
{
|
|
|
|
Directory: "optional-complex-config",
|
|
|
|
Description: "Tests generating code for optional and complex config values",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestNodeJS).Except(TestDotnet),
|
|
|
|
SkipCompile: allProgLanguages.Except(TestNodeJS).Except(TestDotnet),
|
2023-07-14 22:15:28 +00:00
|
|
|
},
|
2023-07-18 06:47:37 +00:00
|
|
|
{
|
|
|
|
Directory: "interpolated-string-keys",
|
|
|
|
Description: "Tests that interpolated string keys are supported in maps. ",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestNodeJS).Except(TestPython),
|
2023-07-18 06:47:37 +00:00
|
|
|
},
|
2023-08-07 19:08:54 +00:00
|
|
|
{
|
|
|
|
Directory: "regress-node-12507",
|
|
|
|
Description: "Regression test for https://github.com/pulumi/pulumi/issues/12507",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestNodeJS),
|
2023-08-07 19:08:54 +00:00
|
|
|
BindOptions: []pcl.BindOption{pcl.PreferOutputVersionedInvokes},
|
|
|
|
},
|
2023-08-07 16:43:37 +00:00
|
|
|
{
|
|
|
|
Directory: "csharp-plain-lists",
|
|
|
|
Description: "Tests that plain lists are supported in C#",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestDotnet),
|
2023-08-07 16:43:37 +00:00
|
|
|
},
|
2023-07-28 18:30:00 +00:00
|
|
|
{
|
|
|
|
Directory: "csharp-typed-for-expressions",
|
|
|
|
Description: "Testing for expressions with typed target expressions in csharp",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestDotnet),
|
2023-07-28 18:30:00 +00:00
|
|
|
},
|
2023-09-28 12:43:35 +00:00
|
|
|
{
|
|
|
|
Directory: "empty-list-property",
|
|
|
|
Description: "Tests compiling empty list expressions of object properties",
|
|
|
|
},
|
2023-10-06 22:26:04 +00:00
|
|
|
{
|
|
|
|
Directory: "python-regress-14037",
|
|
|
|
Description: "Regression test for rewriting qoutes in python",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: allProgLanguages.Except(TestPython),
|
2023-10-06 22:26:04 +00:00
|
|
|
},
|
2023-11-03 14:22:43 +00:00
|
|
|
{
|
|
|
|
Directory: "inline-invokes",
|
|
|
|
Description: "Tests whether using inline invoke expressions works",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
SkipCompile: codegen.NewStringSet(TestGo),
|
2023-11-03 14:22:43 +00:00
|
|
|
},
|
2022-10-27 18:01:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var PulumiPulumiYAMLProgramTests = []ProgramTest{
|
2022-10-20 20:37:10 +00:00
|
|
|
// PCL files from pulumi/yaml transpiled examples
|
|
|
|
{
|
|
|
|
Directory: transpiled("aws-eks"),
|
|
|
|
Description: "AWS EKS",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("aws-static-website"),
|
|
|
|
Description: "AWS static website",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),
|
2022-11-16 01:44:21 +00:00
|
|
|
BindOptions: []pcl.BindOption{pcl.SkipResourceTypechecking},
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("awsx-fargate"),
|
|
|
|
Description: "AWSx Fargate",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestDotnet, TestNodeJS, TestGo),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("azure-app-service"),
|
|
|
|
Description: "Azure App Service",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestDotnet),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("azure-container-apps"),
|
|
|
|
Description: "Azure Container Apps",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet, TestPython),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("azure-static-website"),
|
|
|
|
Description: "Azure static website",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet, TestPython),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("cue-eks"),
|
|
|
|
Description: "Cue EKS",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("cue-random"),
|
|
|
|
Description: "Cue random",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("getting-started"),
|
|
|
|
Description: "Getting started",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("kubernetes"),
|
|
|
|
Description: "Kubernetes",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("pulumi-variable"),
|
|
|
|
Description: "Pulumi variable",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("random"),
|
|
|
|
Description: "Random",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestNodeJS),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("readme"),
|
|
|
|
Description: "README",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestDotnet),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("stackreference-consumer"),
|
|
|
|
Description: "Stack reference consumer",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestNodeJS, TestDotnet),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("stackreference-producer"),
|
|
|
|
Description: "Stack reference producer",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestDotnet),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("webserver-json"),
|
|
|
|
Description: "Webserver JSON",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestDotnet, TestPython),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Directory: transpiled("webserver"),
|
|
|
|
Description: "Webserver",
|
Don't publish test code in `pkg/codegen` (#17517)
Presently, we implement code generation (e.g. for SDKs and
programs/`pulumi convert`) on a per-language basis in `pkg/codegen`.
Alongside these implementations, we have a set of tests built using a
common framework that use snapshots to verify that code generation
doesn't break when changes are made. Unfortunately, due to the way
things are currently laid out in our repository, these tests and their
dependencies are shipped as part of the `pkg/codegen` package. This
commit brings @blampe's work in
https://github.com/pulumi/pulumi/pull/16011 up to date and fixes this by
taking the following actions:
* Test harnesses that were previously located in
`pkg/codegen/<language>/test.go` are moved to
`pkg/codegen/testing/test/<language>.go`.
By default, Go excludes files ending in `_test.go`, but *not* files
named e.g. `test.go`. It might seem logical therefore to just rename
these files (e.g. to `codegen_test.go`), so that they can continue to
live alongside their language implementations. Unfortunately, while this
fixes one problem (dependencies pulling in test code), it introduces
another -- the existing `test.go` files actually exist to implement an
interface which is used by the common codegen-test framework we have.
Moving to `*_test.go` files would make them invisible to the actual
modules which run the tests through that framework.
* Test code is consequently refactored to clean up the separation of
test details (e.g. relevant fixtures) and execution implementation
(working directory, means of program generation).
* The `gen_program_test/generate.go` program, which we use to generate
the "batch tests", has been updated so that it respects the new code
layout and organisation.
As laid out by @blampe in #16011 (and shamelessly copied here), this
brings a number of benefits. Test dependencies are no longer included in
non-test packages that are consumed downstream. As an example, this
takes the `pulumi-language-go` binary from ~61MB down to ~36MB, and
speeds up build times:
```
go clean -cache && time go build .
(master) go build . 81.06s user 17.36s system 470% cpu 20.933 total
(PR) go build . 47.77s user 9.20s system 530% cpu 10.737 total
```
This doesn't completely remove these dependencies from downstream
because most also include `pkg/v3/testing/integration` in tests. It does
only compile these dependencies into the test binary, though.
Before:
```
❯ go mod why github.com/aws/aws-sdk-go-v2/service/sts
github.com/pulumi/pulumi-random/provider/v4/cmd/pulumi-tfgen-random
github.com/pulumi/pulumi-terraform-bridge/pf/tfgen
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen
github.com/pulumi/pulumi/pkg/v3/codegen/dotnet
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
After:
```
github.com/pulumi/pulumi-random/provider/v4
github.com/pulumi/pulumi-random/provider/v4.test <- expected
github.com/pulumi/providertest
github.com/pulumi/pulumi/pkg/v3/testing/integration
github.com/pulumi/pulumi/pkg/v3/resource/stack
github.com/pulumi/pulumi/pkg/v3/secrets/cloud
github.com/pulumi/pulumi/pkg/v3/secrets/cloud.test
github.com/aws/aws-sdk-go-v2/service/sts
```
Note: this PR has been split into a number of commits, roughly one per
language, to make reviewing a bit easier. The commits *do not build
individually* due to the nature of the changes, but hopefully it makes
understanding the work a bit more feasible.
Closes #16011
---------
Co-authored-by: Bryce Lampe <bryce@pulumi.com>
2024-10-09 11:09:54 +00:00
|
|
|
Skip: codegen.NewStringSet(TestGo, TestDotnet, TestPython),
|
2022-10-20 20:37:10 +00:00
|
|
|
},
|
2021-07-28 01:00:39 +00:00
|
|
|
}
|
|
|
|
|
2021-09-29 18:33:57 +00:00
|
|
|
// Checks that a generated program is correct
|
2021-10-19 19:17:19 +00:00
|
|
|
//
|
|
|
|
// The arguments are to be read:
|
|
|
|
// (Testing environment, path to generated code, set of dependencies)
|
|
|
|
type CheckProgramOutput = func(*testing.T, string, codegen.StringSet)
|
2021-09-29 18:33:57 +00:00
|
|
|
|
2021-09-30 03:11:56 +00:00
|
|
|
// Generates a program from a pcl.Program
|
|
|
|
type GenProgram = func(program *pcl.Program) (map[string][]byte, hcl.Diagnostics, error)
|
2021-09-29 18:33:57 +00:00
|
|
|
|
2022-07-20 22:12:02 +00:00
|
|
|
// Generates a project from a pcl.Program
|
2023-08-03 10:40:05 +00:00
|
|
|
type GenProject = func(
|
|
|
|
directory string, project workspace.Project,
|
|
|
|
program *pcl.Program, localDependencies map[string]string,
|
|
|
|
) error
|
2022-07-20 22:12:02 +00:00
|
|
|
|
2021-10-19 19:17:19 +00:00
|
|
|
type ProgramCodegenOptions struct {
|
2021-09-29 18:33:57 +00:00
|
|
|
Language string
|
|
|
|
Extension string
|
|
|
|
OutputFile string
|
|
|
|
Check CheckProgramOutput
|
|
|
|
GenProgram GenProgram
|
2022-02-07 11:10:04 +00:00
|
|
|
TestCases []ProgramTest
|
2022-07-20 22:12:02 +00:00
|
|
|
|
|
|
|
// For generating a full project
|
|
|
|
IsGenProject bool
|
|
|
|
GenProject GenProject
|
|
|
|
// Maps a test file (i.e. "aws-resource-options") to a struct containing a package
|
|
|
|
// (i.e. "github.com/pulumi/pulumi-aws/sdk/v5", "pulumi-aws) and its
|
|
|
|
// version prefixed by an operator (i.e. " v5.11.0", ==5.11.0")
|
|
|
|
ExpectedVersion map[string]PkgVersionInfo
|
|
|
|
DependencyFile string
|
|
|
|
}
|
|
|
|
|
|
|
|
type PkgVersionInfo struct {
|
|
|
|
Pkg string
|
|
|
|
OpAndVersion string
|
2021-07-28 01:00:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TestProgramCodegen runs the complete set of program code generation tests against a particular
|
|
|
|
// language's code generator.
|
|
|
|
//
|
|
|
|
// A program code generation test consists of a PCL file (.pp extension) and a set of expected outputs
|
|
|
|
// for each language.
|
|
|
|
//
|
|
|
|
// The PCL file is the only piece that must be manually authored. Once the schema has been written, the expected outputs
|
|
|
|
// can be generated by running `PULUMI_ACCEPT=true go test ./..." from the `pkg/codegen` directory.
|
2023-01-06 00:07:45 +00:00
|
|
|
//
|
|
|
|
//nolint:revive
|
2021-07-28 01:00:39 +00:00
|
|
|
func TestProgramCodegen(
|
|
|
|
t *testing.T,
|
2021-10-19 19:17:19 +00:00
|
|
|
testcase ProgramCodegenOptions,
|
2021-07-28 01:00:39 +00:00
|
|
|
) {
|
2022-01-08 03:27:14 +00:00
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
t.Skip("TestProgramCodegen is skipped on Windows")
|
|
|
|
}
|
|
|
|
|
2022-02-07 11:10:04 +00:00
|
|
|
assert.NotNil(t, testcase.TestCases, "Caller must provide test cases")
|
2022-01-31 20:48:32 +00:00
|
|
|
pulumiAccept := cmdutil.IsTruthy(os.Getenv("PULUMI_ACCEPT"))
|
2022-05-23 22:44:35 +00:00
|
|
|
skipCompile := cmdutil.IsTruthy(os.Getenv("PULUMI_SKIP_COMPILE_TEST"))
|
2022-10-20 20:37:10 +00:00
|
|
|
|
2022-02-07 11:10:04 +00:00
|
|
|
for _, tt := range testcase.TestCases {
|
2022-03-04 08:17:41 +00:00
|
|
|
tt := tt // avoid capturing loop variable
|
2022-09-08 16:45:15 +00:00
|
|
|
t.Run(tt.Directory, func(t *testing.T) {
|
2023-01-20 00:03:45 +00:00
|
|
|
// These tests should not run in parallel.
|
|
|
|
// They take up a fair bit of memory
|
|
|
|
// and can OOM in CI with too many running.
|
|
|
|
|
2021-09-29 18:33:57 +00:00
|
|
|
var err error
|
|
|
|
if tt.Skip.Has(testcase.Language) {
|
2021-07-28 01:00:39 +00:00
|
|
|
t.Skip()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-09-29 18:33:57 +00:00
|
|
|
expectNYIDiags := tt.ExpectNYIDiags.Has(testcase.Language)
|
2021-07-28 01:00:39 +00:00
|
|
|
|
2022-01-31 20:48:32 +00:00
|
|
|
testDir := filepath.Join(testdataPath, tt.Directory+"-pp")
|
|
|
|
pclFile := filepath.Join(testDir, tt.Directory+".pp")
|
2022-10-20 20:37:10 +00:00
|
|
|
if strings.HasPrefix(tt.Directory, transpiledExamplesDir) {
|
|
|
|
pclFile = filepath.Join(testDir, filepath.Base(tt.Directory)+".pp")
|
|
|
|
}
|
2021-09-29 18:33:57 +00:00
|
|
|
testDir = filepath.Join(testDir, testcase.Language)
|
2023-03-03 16:36:39 +00:00
|
|
|
err = os.MkdirAll(testDir, 0o700)
|
2021-09-29 18:33:57 +00:00
|
|
|
if err != nil && !os.IsExist(err) {
|
|
|
|
t.Fatalf("Failed to create %q: %s", testDir, err)
|
2021-07-28 01:00:39 +00:00
|
|
|
}
|
|
|
|
|
2022-10-20 20:37:10 +00:00
|
|
|
contents, err := os.ReadFile(pclFile)
|
2021-07-28 01:00:39 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not read %v: %v", pclFile, err)
|
|
|
|
}
|
|
|
|
|
2022-01-31 20:48:32 +00:00
|
|
|
expectedFile := filepath.Join(testDir, tt.Directory+"."+testcase.Extension)
|
2022-10-20 20:37:10 +00:00
|
|
|
if strings.HasPrefix(tt.Directory, transpiledExamplesDir) {
|
|
|
|
expectedFile = filepath.Join(testDir, filepath.Base(tt.Directory)+"."+testcase.Extension)
|
|
|
|
}
|
|
|
|
expected, err := os.ReadFile(expectedFile)
|
2022-01-31 20:48:32 +00:00
|
|
|
if err != nil && !pulumiAccept {
|
2021-07-28 01:00:39 +00:00
|
|
|
t.Fatalf("could not read %v: %v", expectedFile, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
parser := syntax.NewParser()
|
2022-01-31 20:48:32 +00:00
|
|
|
err = parser.ParseFile(bytes.NewReader(contents), tt.Directory+".pp")
|
2021-07-28 01:00:39 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not read %v: %v", pclFile, err)
|
|
|
|
}
|
|
|
|
if parser.Diagnostics.HasErrors() {
|
|
|
|
t.Fatalf("failed to parse files: %v", parser.Diagnostics)
|
|
|
|
}
|
|
|
|
|
2022-11-15 01:00:09 +00:00
|
|
|
hclFiles := map[string]*hcl.File{
|
2023-03-03 16:36:39 +00:00
|
|
|
tt.Directory + ".pp": {Body: parser.Files[0].Body, Bytes: parser.Files[0].Bytes},
|
|
|
|
}
|
2024-05-30 19:51:12 +00:00
|
|
|
var pluginHost plugin.Host
|
|
|
|
if tt.PluginHost != nil {
|
|
|
|
pluginHost = tt.PluginHost
|
|
|
|
} else {
|
|
|
|
pluginHost = utils.NewHost(testdataPath)
|
|
|
|
}
|
|
|
|
|
|
|
|
opts := append(tt.BindOptions, pcl.PluginHost(pluginHost))
|
2023-03-08 13:21:34 +00:00
|
|
|
rootProgramPath := filepath.Join(testdataPath, tt.Directory+"-pp")
|
|
|
|
absoluteProgramPath, err := filepath.Abs(rootProgramPath)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed to bind program: unable to find the absolute path of %v", rootProgramPath)
|
|
|
|
}
|
|
|
|
opts = append(opts, pcl.DirPath(absoluteProgramPath))
|
|
|
|
opts = append(opts, pcl.ComponentBinder(pcl.ComponentProgramBinderFromFileSystem()))
|
2022-10-11 10:56:29 +00:00
|
|
|
|
|
|
|
program, diags, err := pcl.BindProgram(parser.Files, opts...)
|
2021-07-28 01:00:39 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not bind program: %v", err)
|
|
|
|
}
|
2022-11-15 01:00:09 +00:00
|
|
|
bindDiags := new(bytes.Buffer)
|
|
|
|
if len(diags) > 0 {
|
|
|
|
require.NoError(t, hcl.NewDiagnosticTextWriter(bindDiags, hclFiles, 80, false).WriteDiagnostics(diags))
|
|
|
|
if diags.HasErrors() {
|
|
|
|
t.Fatalf("failed to bind program:\n%s", bindDiags)
|
|
|
|
}
|
|
|
|
t.Logf("bind diags:\n%s", bindDiags)
|
2021-07-28 01:00:39 +00:00
|
|
|
}
|
2022-07-20 22:12:02 +00:00
|
|
|
var files map[string][]byte
|
|
|
|
// generate a full project and check expected package versions
|
|
|
|
if testcase.IsGenProject {
|
|
|
|
project := workspace.Project{
|
|
|
|
Name: "test",
|
|
|
|
Runtime: workspace.NewProjectRuntimeInfo(testcase.Language, nil),
|
|
|
|
}
|
2023-08-03 10:40:05 +00:00
|
|
|
err = testcase.GenProject(testDir, project, program, nil /*localDependencies*/)
|
2022-07-20 22:12:02 +00:00
|
|
|
assert.NoError(t, err)
|
|
|
|
|
|
|
|
depFilePath := filepath.Join(testDir, testcase.DependencyFile)
|
|
|
|
outfilePath := filepath.Join(testDir, testcase.OutputFile)
|
|
|
|
CheckVersion(t, tt.Directory, depFilePath, testcase.ExpectedVersion)
|
|
|
|
GenProjectCleanUp(t, testDir, depFilePath, outfilePath)
|
|
|
|
}
|
|
|
|
files, diags, err = testcase.GenProgram(program)
|
2021-07-28 01:00:39 +00:00
|
|
|
assert.NoError(t, err)
|
|
|
|
if expectNYIDiags {
|
|
|
|
var tmpDiags hcl.Diagnostics
|
|
|
|
for _, d := range diags {
|
|
|
|
if !strings.HasPrefix(d.Summary, "not yet implemented") {
|
|
|
|
tmpDiags = append(tmpDiags, d)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diags = tmpDiags
|
|
|
|
}
|
|
|
|
if diags.HasErrors() {
|
2022-11-15 01:00:09 +00:00
|
|
|
buf := new(bytes.Buffer)
|
|
|
|
|
|
|
|
err := hcl.NewDiagnosticTextWriter(buf, hclFiles, 80, false).WriteDiagnostics(diags)
|
|
|
|
require.NoError(t, err, "Failed to write diag")
|
|
|
|
|
|
|
|
t.Fatalf("failed to generate program:\n%s", buf)
|
2021-07-28 01:00:39 +00:00
|
|
|
}
|
|
|
|
|
2022-01-31 20:48:32 +00:00
|
|
|
if pulumiAccept {
|
2023-03-03 16:36:39 +00:00
|
|
|
err := os.WriteFile(expectedFile, files[testcase.OutputFile], 0o600)
|
2021-07-28 01:00:39 +00:00
|
|
|
require.NoError(t, err)
|
2023-03-08 13:21:34 +00:00
|
|
|
// generate the rest of the files
|
|
|
|
for fileName, content := range files {
|
|
|
|
if fileName != testcase.OutputFile {
|
|
|
|
outputPath := filepath.Join(testDir, fileName)
|
|
|
|
err := os.WriteFile(outputPath, content, 0o600)
|
|
|
|
require.NoError(t, err, "Failed to write file %s", outputPath)
|
|
|
|
}
|
|
|
|
}
|
2021-09-29 18:33:57 +00:00
|
|
|
} else {
|
|
|
|
assert.Equal(t, string(expected), string(files[testcase.OutputFile]))
|
2023-03-08 13:21:34 +00:00
|
|
|
// assert that the content is correct for the rest of the files
|
|
|
|
for fileName, content := range files {
|
|
|
|
if fileName != testcase.OutputFile {
|
|
|
|
outputPath := filepath.Join(testDir, fileName)
|
|
|
|
outputContent, err := os.ReadFile(outputPath)
|
|
|
|
require.NoError(t, err)
|
|
|
|
assert.Equal(t, string(outputContent), string(content))
|
|
|
|
}
|
|
|
|
}
|
2021-09-29 18:33:57 +00:00
|
|
|
}
|
2022-05-23 22:44:35 +00:00
|
|
|
if !skipCompile && testcase.Check != nil && !tt.SkipCompile.Has(testcase.Language) {
|
2021-10-19 19:17:19 +00:00
|
|
|
extraPulumiPackages := codegen.NewStringSet()
|
2023-03-08 13:21:34 +00:00
|
|
|
collectExtraPulumiPackages(program, extraPulumiPackages)
|
2021-10-19 19:17:19 +00:00
|
|
|
testcase.Check(t, expectedFile, extraPulumiPackages)
|
2021-07-28 01:00:39 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2022-07-20 22:12:02 +00:00
|
|
|
|
2023-03-08 13:21:34 +00:00
|
|
|
func collectExtraPulumiPackages(program *pcl.Program, extraPulumiPackages codegen.StringSet) {
|
|
|
|
for _, n := range program.Nodes {
|
|
|
|
if r, isResource := n.(*pcl.Resource); isResource {
|
|
|
|
pkg, _, _, _ := r.DecomposeToken()
|
|
|
|
if pkg != "pulumi" {
|
|
|
|
extraPulumiPackages.Add(pkg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if component, isComponent := n.(*pcl.Component); isComponent {
|
|
|
|
collectExtraPulumiPackages(component.Program, extraPulumiPackages)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 22:12:02 +00:00
|
|
|
// CheckVersion checks for an expected package version
|
|
|
|
// Todo: support checking multiple package expected versions
|
|
|
|
func CheckVersion(t *testing.T, dir, depFilePath string, expectedVersionMap map[string]PkgVersionInfo) {
|
|
|
|
depFile, err := os.Open(depFilePath)
|
|
|
|
require.NoError(t, err)
|
2022-10-10 23:01:53 +00:00
|
|
|
defer depFile.Close()
|
2022-07-20 22:12:02 +00:00
|
|
|
|
|
|
|
// Splits on newlines by default.
|
|
|
|
scanner := bufio.NewScanner(depFile)
|
|
|
|
|
|
|
|
match := false
|
|
|
|
expectedPkg, expectedVersion := strings.TrimSpace(expectedVersionMap[dir].Pkg),
|
|
|
|
strings.TrimSpace(expectedVersionMap[dir].OpAndVersion)
|
|
|
|
for scanner.Scan() {
|
|
|
|
line := scanner.Text()
|
|
|
|
if strings.Contains(line, expectedPkg) {
|
|
|
|
line = strings.TrimSpace(line)
|
|
|
|
actualVersion := strings.TrimPrefix(line, expectedPkg)
|
|
|
|
actualVersion = strings.TrimSpace(actualVersion)
|
|
|
|
expectedVersion = strings.Trim(expectedVersion, "v:^/> ")
|
|
|
|
actualVersion = strings.Trim(actualVersion, "v:^/> ")
|
|
|
|
if expectedVersion == actualVersion {
|
|
|
|
match = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
actualSemver, err := semver.Make(actualVersion)
|
|
|
|
if err == nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
expectedSemver, _ := semver.Make(expectedVersion)
|
|
|
|
if actualSemver.Compare(expectedSemver) >= 0 {
|
|
|
|
match = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-10 23:01:53 +00:00
|
|
|
require.Truef(t, match, "Did not find expected package version pair (%q,%q). Searched in:\n%s",
|
|
|
|
expectedPkg, expectedVersion, newLazyStringer(func() string {
|
|
|
|
// Reset the read on the file
|
|
|
|
_, err := depFile.Seek(0, io.SeekStart)
|
|
|
|
require.NoError(t, err)
|
|
|
|
buf := new(strings.Builder)
|
|
|
|
_, err = io.Copy(buf, depFile)
|
|
|
|
require.NoError(t, err)
|
|
|
|
return buf.String()
|
|
|
|
}).String())
|
2022-07-20 22:12:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func GenProjectCleanUp(t *testing.T, dir, depFilePath, outfilePath string) {
|
|
|
|
os.Remove(depFilePath)
|
|
|
|
os.Remove(outfilePath)
|
|
|
|
os.Remove(dir + "/.gitignore")
|
|
|
|
os.Remove(dir + "/Pulumi.yaml")
|
|
|
|
}
|
2022-10-10 23:01:53 +00:00
|
|
|
|
|
|
|
type lazyStringer struct {
|
|
|
|
cache string
|
|
|
|
f func() string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l lazyStringer) String() string {
|
|
|
|
if l.cache == "" {
|
|
|
|
l.cache = l.f()
|
|
|
|
}
|
|
|
|
return l.cache
|
|
|
|
}
|
|
|
|
|
|
|
|
// The `fmt` `%s` calls .String() if the object is not a string itself. We can delay
|
|
|
|
// computing expensive display logic until and unless we actually will use it.
|
|
|
|
func newLazyStringer(f func() string) fmt.Stringer {
|
|
|
|
return lazyStringer{f: f}
|
|
|
|
}
|