pulumi/tests
bors[bot] 7efd298867
Merge #11829 #11833
11829: golangci-lint: Don't disable megacheck r=abhinav a=abhinav

As a pre-step to enabling staticcheck (#11808)
drop megacheck from the list of disabled linters.

This was suppressing the output of some other linters
that are enabled by default including gosimple and unused.

## Issues fixed

### pkg

```
cmd/pulumi/preview.go:199:4: S1011: should replace loop with `targetURNs = append(targetURNs, targets...)` (gosimple)
cmd/pulumi/preview.go:204:4: S1011: should replace loop with `replaceURNs = append(replaceURNs, replaces...)` (gosimple)
cmd/pulumi/refresh.go:248:4: S1011: should replace loop with `targetUrns = append(targetUrns, *targets...)` (gosimple)
cmd/pulumi/up.go:130:3: S1011: should replace loop with `targetURNs = append(targetURNs, targets...)` (gosimple)
cmd/pulumi/up.go:134:3: S1011: should replace loop with `replaceURNs = append(replaceURNs, replaces...)` (gosimple)
resource/stack/deployment.go:61:5: var `resourceSchema` is unused (unused)
codegen/hcl2/model/pretty/display.go:227:6: S1003: should use strings.ContainsRune(v, '\n') instead (gosimple)
codegen/hcl2/model/pretty/display.go:289:6: S1003: should use strings.ContainsRune(v, '\n') instead (gosimple)
codegen/nodejs/gen.go:110:2: S1029: should range over string, not []rune(string) (gosimple)
codegen/nodejs/gen_program.go:381:2: S1008: should use 'return makeValidIdentifier(outputName) != outputName' instead of 'if makeValidIdentifier(outputName) != outputName { return true }; return false' (gosimple)
codegen/go/gen_program_json.go:30:2: field `temps` is unused (unused)
codegen/go/gen_program_json.go:34:24: func `(*jsonSpiller).spillExpression` is unused (unused)
codegen/go/gen_program_json.go:12:6: type `jsonTemp` is unused (unused)
codegen/go/gen_program_expressions.go:542:21: func `(*generator).genRelativeTraversalExpression` is unused (unused)
codegen/go/gen_program_json.go:21:21: func `(*jsonTemp).Traverse` is unused (unused)
codegen/go/gen_program_json.go:31:2: field `count` is unused (unused)
codegen/go/gen_program.go:484:21: func `(*generator).getPkgContext` is unused (unused)
codegen/go/gen_program_json.go:17:21: func `(*jsonTemp).Type` is unused (unused)
codegen/go/gen_program_json.go:25:21: func `(*jsonTemp).SyntaxNode` is unused (unused)
codegen/go/gen_test.go:399:4: S1023: redundant break statement (gosimple)
codegen/python/gen_program.go:337:41: S1040: type assertion to the same type: destType already has type model.Type (gosimple)
backend/display/jsonmessage.go:176:27: func `(*messageRenderer).writeBlankLine` is unused (unused)
backend/display/progress.go:1239:21: S1012: should use `time.Since` instead of `time.Now().Sub` (gosimple)
codegen/hcl2/syntax/tokens.go:265:2: S1001: should use copy() instead of a loop (gosimple)
testing/integration/util.go:195:2: S1006: should use for {} instead of for true {} (gosimple)
testing/integration/program.go:456:3: S1011: should replace loop with `opts.OrderedConfig = append(opts.OrderedConfig, overrides.OrderedConfig...)` (gosimple)
testing/integration/program.go:690:3: S1038: should use t.Skipf(...) instead of t.Skip(fmt.Sprintf(...)) (gosimple)
codegen/dotnet/gen_program.go:255:21: func `(*generator).warnf` is unused (unused)
codegen/dotnet/gen.go:62:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple)
codegen/dotnet/gen_program.go:515:41: S1040: type assertion to the same type: destType already has type model.Type (gosimple)
codegen/schema/loader.go:116:9: S1039: unnecessary use of fmt.Sprintf (gosimple)
```

### sdk

```
python/cmd/pulumi-language-python/main.go:532:3: S1029: should range over string, not []rune(string) (gosimple)
go/common/resource/plugin/context.go:145:8: S1005: unnecessary assignment to the blank identifier (gosimple)
go/common/resource/plugin/context.go:144:3: S1000: should use a simple channel send/receive instead of `select` with a single case (gosimple)
go/common/util/env/env.go:198:9: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple)
go/pulumi/resource_set.go:9:22: func `resourceSet.any` is unused (unused)
go/pulumi/resource_set.go:17:22: func `resourceSet.has` is unused (unused)
go/pulumi/resource_set.go:13:22: func `resourceSet.delete` is unused (unused)
go/pulumi/types_test.go:444:12: S1040: type assertion to the same type: argsV.R already has type Resource (gosimple)
go/auto/stack.go:153:2: S1021: should merge variable declaration with assignment on next line (gosimple)
go/auto/stack.go:170:2: S1021: should merge variable declaration with assignment on next line (gosimple)
go/common/resource/asset_test.go:391:6: func `findRepositoryRoot` is unused (unused)
go/common/util/goversion/version.go:32:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple)
```

### tests

There were a couple functions marked unused
that are used by tests that are currently skipped.
I've added `//nolint:unused` for those.


11833: crypto/ssh/terminal is deprecated r=abhinav a=abhinav

golang.org/x/crypto/ssh/terminal is deprecated.
golang.org/x/term is a near drop-in replacement for it.

In service to #11808


Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
2023-01-11 22:30:25 +00:00
..
benchmarks/go-alias-norm ci: Simplify test listing, update go dependencies to 1.18 compat 2022-09-21 09:51:59 -07:00
examples ci: Implement smoke tests for pkg/cmd, fix examples 2022-10-17 22:07:47 -07:00
integration Merge #11829 #11833 2023-01-11 22:30:25 +00:00
testprovider sdk/go: Remove 'nolint' directives from package docs 2023-01-06 09:06:47 -08:00
.gitignore ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
README.md updated readme 2023-01-03 08:30:05 -08:00
about_test.go test: fix regex used to test Go version output in about command. (#10499) 2022-08-29 11:53:03 -07:00
config_test.go ci: adjust test based on new yaml library 2022-12-10 14:26:14 -08:00
go.mod chore: post-release go.mod updates 2023-01-04 15:53:19 +00:00
go.sum Merge #11665 2022-12-16 11:35:04 +00:00
history_test.go ci: gofmt 1.18+ clean 2022-09-21 09:48:39 -07:00
login_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
main_test.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
remote_test.go [cli] Test remote operations 2022-11-09 05:29:20 -08:00
roundtrip_test.go sdk/go: Remove 'nolint' directives from package docs 2023-01-06 09:06:47 -08:00
stack_test.go all: Drop ioutil 2023-01-06 16:35:14 -08:00

README.md

Integration Tests

This module provides integration tests for the Pulumi CLI.

The tests can be run via:

make test_all

Usage of Go build tags

In order to speed up integration tests in GitHub actions, Go build tags are used to conditionally compile the desired test cases.

// integration_nodejs_test.go
//go:build (nodejs || all) && !smoke

// integration_nodejs_smoke_test.go
//go:build nodejs || all