Compare commits
8 commits
master
...
pgavlin/co
Author | SHA1 | Date | |
---|---|---|---|
b45c31043b | |||
d2825522f2 | |||
9d233c0140 | |||
008ac014d4 | |||
96746ddeab | |||
960a044abc | |||
c72bd3568a | |||
6ffea35ddc |
24
.github/workflows/master.yml
vendored
24
.github/workflows/master.yml
vendored
|
@ -31,7 +31,7 @@ jobs:
|
|||
language: ["nodejs", "python", "dotnet"]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -86,7 +86,7 @@ jobs:
|
|||
go-version: [1.17.x]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout Repo
|
||||
|
@ -149,7 +149,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -218,8 +218,11 @@ jobs:
|
|||
- name: Set PULUMI_TEST_SUBSET env var
|
||||
run: |
|
||||
echo "PULUMI_TEST_SUBSET=${{ matrix.test-subset }}" >> $GITHUB_ENV
|
||||
- name: Enable code coverage
|
||||
run: |
|
||||
echo "PULUMI_TEST_COVERAGE_PATH=$(pwd)/coverage" >> $GITHUB_ENV
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -285,6 +288,17 @@ jobs:
|
|||
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
|
||||
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
|
||||
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
|
||||
- name: Merge Go coverage data
|
||||
run: |
|
||||
pulumictl cover merge -in ./coverage -out ./coverage/go-all.txt
|
||||
rm ./coverage/*.cov
|
||||
- name: Upload code coverage
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
directory: coverage
|
||||
files: '*'
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
windows-build:
|
||||
name: Windows Build + Test + Publish
|
||||
strategy:
|
||||
|
@ -314,7 +328,7 @@ jobs:
|
|||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
|
10
.github/workflows/prerelease.yml
vendored
10
.github/workflows/prerelease.yml
vendored
|
@ -31,7 +31,7 @@ jobs:
|
|||
language: ["nodejs", "python", "dotnet"]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -85,7 +85,7 @@ jobs:
|
|||
go-version: [1.17.x]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout Repo
|
||||
|
@ -132,7 +132,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -196,7 +196,7 @@ jobs:
|
|||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -291,7 +291,7 @@ jobs:
|
|||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
|
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
|
@ -123,7 +123,7 @@ jobs:
|
|||
language: ["nodejs", "python", "dotnet"]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -177,7 +177,7 @@ jobs:
|
|||
go-version: [1.17.x]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout Repo
|
||||
|
@ -225,7 +225,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -295,7 +295,7 @@ jobs:
|
|||
run: |
|
||||
echo "PULUMI_TEST_SUBSET=${{ matrix.test-subset }}" >> $GITHUB_ENV
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -397,7 +397,7 @@ jobs:
|
|||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
|
|
@ -71,7 +71,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -159,8 +159,11 @@ jobs:
|
|||
- name: Set PULUMI_TEST_SUBSET env var
|
||||
run: |
|
||||
echo "PULUMI_TEST_SUBSET=${{ matrix.test-subset }}" >> $GITHUB_ENV
|
||||
- name: Enable code coverage
|
||||
run: |
|
||||
echo "PULUMI_TEST_COVERAGE_PATH=$(pwd)/coverage" >> $GITHUB_ENV
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
@ -236,6 +239,17 @@ jobs:
|
|||
PULUMI_NODE_MODULES: ${{ runner.temp }}/opt/pulumi/node_modules
|
||||
PULUMI_LOCAL_NUGET: ${{ runner.temp }}/opt/pulumi/nuget
|
||||
PULUMI_ROOT: ${{ runner.temp }}/opt/pulumi
|
||||
- name: Merge Go coverage data
|
||||
run: |
|
||||
pulumictl cover merge -in ./coverage -out ./coverage/go-all.txt
|
||||
rm ./coverage/*.cov
|
||||
- name: Upload code coverage
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
directory: coverage
|
||||
files: '*'
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
- name: Summarize Test Time by Package
|
||||
run: |
|
||||
mkdir -p test-results
|
||||
|
@ -270,7 +284,7 @@ jobs:
|
|||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Set up Go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
|
2
.github/workflows/run-codegen-test.yml
vendored
2
.github/workflows/run-codegen-test.yml
vendored
|
@ -40,7 +40,7 @@ jobs:
|
|||
fail-fast: false
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17.x
|
||||
- name: Install Node.js
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,6 +10,7 @@
|
|||
coverage.cov
|
||||
*.coverprofile
|
||||
**/obj/
|
||||
coverage/
|
||||
|
||||
**/.idea/
|
||||
*.iml
|
||||
|
|
19
Makefile
19
Makefile
|
@ -31,18 +31,31 @@ generate::
|
|||
$(call STEP_MESSAGE)
|
||||
echo "This command does not do anything anymore. It will be removed in a future version."
|
||||
|
||||
ifeq ($(PULUMI_TEST_COVERAGE_PATH),)
|
||||
build::
|
||||
cd pkg && go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
|
||||
|
||||
install::
|
||||
cd pkg && GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
|
||||
else
|
||||
build:: build_cover
|
||||
mkdir -p $(PULUMI_TEST_COVERAGE_PATH)
|
||||
|
||||
install:: install_cover
|
||||
endif
|
||||
|
||||
build_debug::
|
||||
cd pkg && go install -gcflags="all=-N -l" -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
|
||||
|
||||
build_cover::
|
||||
cd pkg && go test -coverpkg github.com/pulumi/pulumi/pkg/v3/...,github.com/pulumi/pulumi/sdk/v3/... -cover -c -o $(shell go env GOPATH)/bin/pulumi -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
|
||||
|
||||
install_cover:: build_cover
|
||||
cp $(shell go env GOPATH)/bin/pulumi $(PULUMI_BIN)
|
||||
|
||||
developer_docs::
|
||||
cd developer-docs && make html
|
||||
|
||||
install::
|
||||
cd pkg && GOBIN=$(PULUMI_BIN) go install -ldflags "-X github.com/pulumi/pulumi/pkg/v3/version.Version=${VERSION}" ${PROJECT}
|
||||
|
||||
install_all:: install
|
||||
|
||||
dist:: build
|
||||
|
|
81
pkg/cmd/pulumi/main_test.go
Normal file
81
pkg/cmd/pulumi/main_test.go
Normal file
|
@ -0,0 +1,81 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
type noTestDeps int
|
||||
|
||||
func (noTestDeps) ImportPath() string { return "" }
|
||||
func (noTestDeps) MatchString(pat, str string) (bool, error) { return false, nil }
|
||||
func (noTestDeps) SetPanicOnExit0(bool) {}
|
||||
func (noTestDeps) StartCPUProfile(io.Writer) error { return nil }
|
||||
func (noTestDeps) StopCPUProfile() {}
|
||||
func (noTestDeps) StartTestLog(io.Writer) {}
|
||||
func (noTestDeps) StopTestLog() error { return nil }
|
||||
func (noTestDeps) WriteProfileTo(string, io.Writer, int) error { return nil }
|
||||
|
||||
// flushProfiles flushes test profiles to disk.
|
||||
func flushProfiles() {
|
||||
// Redirect Stdout/err temporarily so the testing code doesn't output the
|
||||
// regular:
|
||||
// PASS
|
||||
// coverage: 21.4% of statements
|
||||
oldstdout, oldstderr := os.Stdout, os.Stderr
|
||||
defer func() {
|
||||
os.Stdout, os.Stderr = oldstdout, oldstderr
|
||||
}()
|
||||
os.Stdout, _ = os.Open(os.DevNull)
|
||||
os.Stderr, _ = os.Open(os.DevNull)
|
||||
|
||||
cmdLine := flag.CommandLine
|
||||
defer func() { flag.CommandLine = cmdLine }()
|
||||
flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
|
||||
err := flag.CommandLine.Parse(nil)
|
||||
contract.IgnoreError(err)
|
||||
|
||||
m := testing.MainStart(noTestDeps(0), nil, nil, nil)
|
||||
m.Run()
|
||||
}
|
||||
|
||||
func addGoFlag(pf *pflag.FlagSet, f *flag.Flag) {
|
||||
if pf.Lookup(f.Name) != nil || len(f.Name) == 1 && pf.ShorthandLookup(f.Name) != nil {
|
||||
return
|
||||
}
|
||||
pf.AddGoFlag(f)
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// If the binary is invoked as `pulumi`, we are being asked to run the coverage-instrumented program. Otherwise,
|
||||
// we are running tests as usual.
|
||||
if path.Base(os.Args[0]) != "pulumi" {
|
||||
flag.Parse()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
defer panicHandler()
|
||||
|
||||
// Copy the test flags into the Pulumi command's flags.
|
||||
cmd := NewPulumiCmd()
|
||||
flag.CommandLine.VisitAll(func(f *flag.Flag) {
|
||||
addGoFlag(cmd.PersistentFlags(), f)
|
||||
})
|
||||
|
||||
// Now, execute the Pulumi command and dump coverage data if requested.
|
||||
err := cmd.Execute()
|
||||
flushProfiles()
|
||||
|
||||
if err != nil {
|
||||
_, err = fmt.Fprintf(os.Stderr, "An error occurred: %v\n", err)
|
||||
contract.IgnoreError(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ require (
|
|||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
|
||||
github.com/spf13/cobra v1.0.0
|
||||
github.com/spf13/pflag v1.0.3
|
||||
github.com/stretchr/testify v1.6.1
|
||||
github.com/tklauser/go-sysconf v0.3.8 // indirect
|
||||
github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7
|
||||
|
@ -54,6 +55,7 @@ require (
|
|||
golang.org/x/net v0.0.0-20210505214959-0714010a04ed
|
||||
golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
golang.org/x/tools v0.1.0
|
||||
google.golang.org/api v0.46.0
|
||||
google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2
|
||||
google.golang.org/grpc v1.37.0
|
||||
|
|
|
@ -228,6 +228,12 @@ type ProgramTestOptions struct {
|
|||
// file.
|
||||
Tracing string
|
||||
|
||||
// If non-empty, specifies the value of the `--test.coverprofile` flag to pass to the Pulumi CLI. As with the
|
||||
// Tracing field, the `{command}` template will expand to the current command name.
|
||||
//
|
||||
// If PULUMI_TEST_COVERAGE_PATH is set, this defaults to $PULUMI_TEST_COVERAGE_PATH/{command}-[random suffix].out
|
||||
CoverProfile string
|
||||
|
||||
// NoParallel will opt the test out of being ran in parallel.
|
||||
NoParallel bool
|
||||
|
||||
|
@ -447,6 +453,9 @@ func (opts ProgramTestOptions) With(overrides ProgramTestOptions) ProgramTestOpt
|
|||
if overrides.Tracing != "" {
|
||||
opts.Tracing = overrides.Tracing
|
||||
}
|
||||
if overrides.CoverProfile != "" {
|
||||
opts.CoverProfile = overrides.CoverProfile
|
||||
}
|
||||
if overrides.NoParallel {
|
||||
opts.NoParallel = overrides.NoParallel
|
||||
}
|
||||
|
@ -606,6 +615,16 @@ func prepareProgram(t *testing.T, opts *ProgramTestOptions) {
|
|||
if opts.Tracing == "" {
|
||||
opts.Tracing = os.Getenv("PULUMI_TEST_TRACE_ENDPOINT")
|
||||
}
|
||||
|
||||
if opts.CoverProfile == "" {
|
||||
if cov := os.Getenv("PULUMI_TEST_COVERAGE_PATH"); cov != "" {
|
||||
var b [4]byte
|
||||
if _, err := cryptorand.Read(b[:]); err != nil {
|
||||
t.Errorf("could not read random bytes: %v", err)
|
||||
}
|
||||
opts.CoverProfile = filepath.Join(cov, "{command}-"+hex.EncodeToString(b[:])+".cov")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ProgramTest runs a lifecycle of Pulumi commands in a program working directory, using the `pulumi` and `yarn`
|
||||
|
@ -746,6 +765,9 @@ func (pt *ProgramTester) pulumiCmd(name string, args []string) ([]string, error)
|
|||
if tracing := pt.opts.Tracing; tracing != "" {
|
||||
cmd = append(cmd, "--tracing", strings.ReplaceAll(tracing, "{command}", name))
|
||||
}
|
||||
if cov := pt.opts.CoverProfile; cov != "" {
|
||||
cmd = append(cmd, "--test.coverprofile", strings.ReplaceAll(cov, "{command}", name))
|
||||
}
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,13 @@ if not packages:
|
|||
sys.exit(0)
|
||||
|
||||
|
||||
options_and_packages = options(options_and_packages) + packages
|
||||
options = options(options_and_packages)
|
||||
cov = os.environ.get('PULUMI_TEST_COVERAGE_PATH', None)
|
||||
if cov is not None:
|
||||
options = options + [f'-coverprofile={cov}/go-test-{os.urandom(4).hex()}.cov', '-coverpkg=github.com/pulumi/pulumi/pkg/v3/...,github.com/pulumi/pulumi/sdk/v3/...']
|
||||
|
||||
|
||||
options_and_packages = options + packages
|
||||
|
||||
|
||||
if shutil.which('gotestsum') is not None:
|
||||
|
|
|
@ -18,6 +18,12 @@ ensure::
|
|||
# We want to dotnet restore all projects on startup so that omnisharp doesn't complain about lots of missing types on startup.
|
||||
dotnet restore dotnet.sln
|
||||
|
||||
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
|
||||
TEST_COVERAGE_ARGS := /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(PULUMI_TEST_COVERAGE_PATH)
|
||||
else
|
||||
TEST_COVERAGE_ARGS := /p:CollectCoverage=false /p:CoverletOutput=$(PULUMI_TEST_COVERAGE_PATH)
|
||||
endif
|
||||
|
||||
build::
|
||||
# From the nuget docs:
|
||||
#
|
||||
|
@ -45,11 +51,11 @@ install:: build install_plugin
|
|||
|
||||
dotnet_test:: $(TEST_ALL_DEPS)
|
||||
# include the version prefix/suffix to avoid generating a separate nupkg file
|
||||
$(RUN_TESTSUITE) dotnet-test dotnet test --no-build --filter --filter FullyQualifiedName\\!~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
|
||||
$(RUN_TESTSUITE) dotnet-test dotnet test --no-build --filter FullyQualifiedName\!~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION} ${TEST_COVERAGE_ARGS}/dotnet.xml
|
||||
|
||||
auto_test:: $(TEST_ALL_DEPS)
|
||||
# include the version prefix/suffix to avoid generating a separate nupkg file
|
||||
$(RUN_TESTSUITE) auto-dotnet dotnet test --no-build --filter --filter FullyQualifiedName~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION}
|
||||
$(RUN_TESTSUITE) auto-dotnet dotnet test --no-build --filter FullyQualifiedName~Pulumi.Automation.Tests /p:Version=${DOTNET_VERSION} ${TEST_COVERAGE_ARGS}/dotnet-auto.xml
|
||||
|
||||
test_fast:: dotnet_test
|
||||
$(GO_TEST_FAST) ${PROJECT_PKGS}
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||
<PackageReference Include="Moq" Version="4.13.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
|
|
|
@ -63,6 +63,13 @@ func Flush() {
|
|||
glog.Flush()
|
||||
}
|
||||
|
||||
func maybeSetFlag(name, value string) {
|
||||
if f := flag.Lookup(name); f != nil {
|
||||
err := f.Value.Set(value)
|
||||
assertNoError(err)
|
||||
}
|
||||
}
|
||||
|
||||
// InitLogging ensures the logging library has been initialized with the given settings.
|
||||
func InitLogging(logToStderr bool, verbose int, logFlow bool) {
|
||||
// Remember the settings in case someone inquires.
|
||||
|
@ -78,12 +85,10 @@ func InitLogging(logToStderr bool, verbose int, logFlow bool) {
|
|||
assertNoError(err)
|
||||
}
|
||||
if logToStderr {
|
||||
err := flag.Lookup("logtostderr").Value.Set("true")
|
||||
assertNoError(err)
|
||||
maybeSetFlag("logtostderr", "true")
|
||||
}
|
||||
if verbose > 0 {
|
||||
err := flag.Lookup("v").Value.Set(strconv.Itoa(verbose))
|
||||
assertNoError(err)
|
||||
maybeSetFlag("v", strconv.Itoa(verbose))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
1
sdk/nodejs/.gitignore
vendored
1
sdk/nodejs/.gitignore
vendored
|
@ -4,3 +4,4 @@
|
|||
/node_modules/
|
||||
/custom_node/
|
||||
/runtime/native/node_dev/
|
||||
.nyc_output/
|
||||
|
|
|
@ -46,25 +46,28 @@ install_plugin:: build
|
|||
|
||||
install:: install_package install_plugin
|
||||
|
||||
istanbul_tests:: $(TEST_ALL_DEPS)
|
||||
$(RUN_TESTSUITE) istanbul ./node_modules/.bin/istanbul test --print none _mocha -- --timeout 120000 --exclude 'bin/tests/automation/**/*.spec.js' 'bin/tests/**/*.spec.js'
|
||||
./node_modules/.bin/istanbul report text-summary
|
||||
./node_modules/.bin/istanbul report text
|
||||
$(RUN_TESTSUITE) istanbul-with-mocks ./node_modules/.bin/istanbul test --print none _mocha -- 'bin/tests_with_mocks/**/*.spec.js'
|
||||
unit_tests:: $(TEST_ALL_DEPS)
|
||||
$(RUN_TESTSUITE) unit-nodejs ./node_modules/.bin/nyc -x 'bin/tests/runtime/*ClosureCases*.js' -s mocha --timeout 120000 --exclude 'bin/tests/automation/**/*.spec.js' --exclude 'bin/tests/runtime/closureLoader.spec.js' 'bin/tests/**/*.spec.js'
|
||||
$(RUN_TESTSUITE) unit-nodejs mocha --timeout 120000 'bin/tests/runtime/closureLoader.spec.js'
|
||||
$(RUN_TESTSUITE) unit-with-mocks-nodejs ./node_modules/.bin/nyc -s mocha 'bin/tests_with_mocks/**/*.spec.js'
|
||||
|
||||
auto_tests:: $(TEST_ALL_DEPS)
|
||||
$(RUN_TESTSUITE) auto-nodejs ./node_modules/.bin/istanbul test --print none _mocha -- --timeout 120000 'bin/tests/automation/**/*.spec.js'
|
||||
./node_modules/.bin/istanbul report text-summary
|
||||
./node_modules/.bin/istanbul report text
|
||||
$(RUN_TESTSUITE) auto-nodejs ./node_modules/.bin/nyc -s mocha --timeout 120000 'bin/tests/automation/**/*.spec.js'
|
||||
|
||||
sxs_tests:: $(TEST_ALL_DEPS)
|
||||
pushd tests/sxs_ts_3.6 && yarn ; tsc ; popd
|
||||
pushd tests/sxs_ts_latest && yarn ; tsc ; popd
|
||||
|
||||
test_fast:: sxs_tests istanbul_tests
|
||||
test_fast:: sxs_tests unit_tests
|
||||
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
|
||||
if [ -e .nyc_output ]; then ./node_modules/.bin/nyc report -r cobertura --report-dir $(PULUMI_TEST_COVERAGE_PATH); fi
|
||||
endif
|
||||
$(GO_TEST_FAST) ${PROJECT_PKGS}
|
||||
|
||||
test_all:: sxs_tests istanbul_tests auto_tests
|
||||
test_all:: sxs_tests unit_tests auto_tests
|
||||
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
|
||||
if [ -e .nyc_output ]; then ./node_modules/.bin/nyc report -r cobertura --report-dir $(PULUMI_TEST_COVERAGE_PATH); fi
|
||||
endif
|
||||
$(GO_TEST) ${PROJECT_PKGS}
|
||||
|
||||
dist:: build
|
||||
|
|
|
@ -39,13 +39,16 @@
|
|||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-header": "^3.1.1",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"istanbul": "^0.4.5",
|
||||
"mocha": "^3.5.0"
|
||||
"nyc": "^15.1.0",
|
||||
"mocha": "^9.0.0"
|
||||
},
|
||||
"pulumi": {
|
||||
"comment": "Do not remove. Marks this as as a deployment-time-only package"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.13.0 || >=10.10.0"
|
||||
},
|
||||
"mocha": {
|
||||
"require": ["ts-node/register", "source-map-support/register"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": false,
|
||||
"sourceMap": true,
|
||||
"stripInternal": true,
|
||||
"experimentalDecorators": true,
|
||||
"pretty": true,
|
||||
|
|
1
sdk/python/.gitignore
vendored
1
sdk/python/.gitignore
vendored
|
@ -4,3 +4,4 @@
|
|||
/env/
|
||||
/*.egg-info
|
||||
.venv/
|
||||
.coverage
|
||||
|
|
|
@ -50,14 +50,20 @@ test_fast:: $(TEST_ALL_DEPS)
|
|||
$(GO_TEST) ${PROJECT_PKGS}
|
||||
pipenv install -e ./env/src
|
||||
# TODO the ignored test seems to fail in pytest but not unittest. Need to trackdown why
|
||||
$(RUN_TESTSUITE) python/lib/test pipenv run pytest lib/test --ignore lib/test/automation --ignore lib/test/langhost/resource_thens/test_resource_thens.py
|
||||
$(RUN_TESTSUITE) python/lib/test/langhost/resource_thens pipenv run python -m unittest lib/test/langhost/resource_thens/test_resource_thens.py
|
||||
$(RUN_TESTSUITE) python/lib/test pipenv run coverage run -m pytest lib/test --ignore lib/test/automation --ignore lib/test/langhost/resource_thens/test_resource_thens.py
|
||||
$(RUN_TESTSUITE) python/lib/test/langhost/resource_thens pipenv run coverage run -m unittest lib/test/langhost/resource_thens/test_resource_thens.py
|
||||
# Using python -m also adds lib/test_with_mocks to sys.path which avoids package resolution issues.
|
||||
pushd lib/test_with_mocks; $(RUN_TESTSUITE) python/lib/test_with_mocks pipenv run python -m pytest; popd
|
||||
pushd lib/test_with_mocks; $(RUN_TESTSUITE) python/lib/test_with_mocks pipenv run coverage run -m pytest; popd
|
||||
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
|
||||
if [ -e .coverage ]; then pipenv run coverage xml -o $(PULUMI_TEST_COVERAGE_PATH)/python-fast.xml; fi
|
||||
endif
|
||||
|
||||
test_auto:: test_fast $(TEST_ALL_DEPS)
|
||||
# Note that this target depends on test-fast for the call to `pipenv run pip install`
|
||||
$(RUN_TESTSUITE) auto-python pipenv run pytest lib/test/automation
|
||||
$(RUN_TESTSUITE) auto-python pipenv run coverage run -m pytest lib/test/automation
|
||||
ifneq ($(PULUMI_TEST_COVERAGE_PATH),)
|
||||
if [ -e .coverage ]; then pipenv run coverage xml -o $(PULUMI_TEST_COVERAGE_PATH)/python-auto.xml; fi
|
||||
endif
|
||||
|
||||
test_all:: test_fast test_auto
|
||||
|
||||
|
|
|
@ -21,3 +21,4 @@ types-six = "*"
|
|||
types-pyyaml = "*"
|
||||
types-protobuf = "*"
|
||||
pytest-asyncio = "*"
|
||||
coverage = ">=6.0.2"
|
||||
|
|
Loading…
Reference in a new issue