mirror of https://github.com/dapr/cli.git
Parallel exec for UTs and cache go dep (#1226)
* Parallel exec for UTs and cache go dep Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com> * update go version Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com> --------- Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>
This commit is contained in:
parent
de997a9fda
commit
a4aafbdfd4
|
@ -29,7 +29,7 @@ jobs:
|
|||
name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
GOVER: 1.19.3
|
||||
GOVER: 1.19.6
|
||||
GOLANG_CI_LINT_VER: v1.49.0
|
||||
GOOS: ${{ matrix.target_os }}
|
||||
GOARCH: ${{ matrix.target_arch }}
|
||||
|
@ -63,6 +63,36 @@ jobs:
|
|||
go-version: ${{ env.GOVER }}
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Go modules (Linux)
|
||||
if: matrix.target_os == 'linux'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
|
||||
- name: Cache Go modules (Windows)
|
||||
if: matrix.target_os == 'windows'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~\AppData\Local\go-build
|
||||
~\go\pkg\mod
|
||||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
|
||||
- name: Cache Go modules (macOS)
|
||||
if: matrix.target_os == 'darwin'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/Library/Caches/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
|
||||
- name: Run golangci-lint
|
||||
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux'
|
||||
uses: golangci/golangci-lint-action@v3.2.0
|
||||
|
|
|
@ -50,7 +50,7 @@ jobs:
|
|||
name: E2E tests for K8s (KinD)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GOVER: 1.19.3
|
||||
GOVER: 1.19.6
|
||||
DAPR_RUNTIME_PINNED_VERSION: 1.10.0
|
||||
DAPR_DASHBOARD_PINNED_VERSION: 0.12.0
|
||||
DAPR_RUNTIME_LATEST_STABLE_VERSION:
|
||||
|
@ -88,6 +88,15 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: ./src/github.com/dapr/cli
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ env.GOVER }}-
|
||||
|
||||
- name: Configure KinD
|
||||
# Generate a KinD configuration file that uses:
|
||||
|
|
|
@ -35,7 +35,7 @@ jobs:
|
|||
name: Run Self-Hosted E2E tests in ${{ matrix.target_os }}_${{ matrix.target_arch }}_${{ matrix.dapr_install_mode }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
GOVER: 1.19.3
|
||||
GOVER: 1.19.6
|
||||
GOOS: ${{ matrix.target_os }}
|
||||
GOARCH: ${{ matrix.target_arch }}
|
||||
GOPROXY: https://proxy.golang.org
|
||||
|
@ -65,7 +65,37 @@ jobs:
|
|||
with:
|
||||
go-version: ${{ env.GOVER }}
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Cache Go modules (Linux)
|
||||
if: matrix.target_os == 'linux'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
|
||||
- name: Cache Go modules (Windows)
|
||||
if: matrix.target_os == 'windows'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~\AppData\Local\go-build
|
||||
~\go\pkg\mod
|
||||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
|
||||
- name: Cache Go modules (macOS)
|
||||
if: matrix.target_os == 'darwin'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/Library/Caches/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
|
||||
- name: Install podman - MacOS
|
||||
if: matrix.os == 'macos-latest' && matrix.dapr_install_mode == 'complete'
|
||||
run: |
|
||||
|
|
|
@ -50,7 +50,7 @@ jobs:
|
|||
name: Upgrade path tests (KinD)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GOVER: 1.19.3
|
||||
GOVER: 1.19.6
|
||||
strategy:
|
||||
fail-fast: false # Keep running if one leg fails.
|
||||
matrix:
|
||||
|
@ -80,9 +80,19 @@ jobs:
|
|||
with:
|
||||
go-version: ${{ env.GOVER }}
|
||||
- name: Check out code onto GOPATH
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ./src/github.com/dapr/cli
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ env.GOVER }}-
|
||||
|
||||
|
||||
- name: Configure KinD
|
||||
# Generate a KinD configuration file that uses:
|
||||
|
|
|
@ -20,6 +20,7 @@ import (
|
|||
)
|
||||
|
||||
func TestDashboardRun(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("build Cmd", func(t *testing.T) {
|
||||
cmd, err := NewDashboardCmd("", 9090)
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ var (
|
|||
)
|
||||
|
||||
func TestRunConfigFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("test parse valid run template", func(t *testing.T) {
|
||||
appsRunConfig := RunFileConfig{}
|
||||
err := appsRunConfig.parseAppsConfig(validRunFilePath)
|
||||
|
|
|
@ -96,7 +96,9 @@ func TestResolveImageWithGHCR(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
got, err := resolveImageURI(test.args)
|
||||
assert.Equal(t, test.expectErr, err != nil)
|
||||
assert.Equal(t, test.expect, got)
|
||||
|
@ -140,7 +142,9 @@ func TestResolveImageWithDockerHub(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
got, err := resolveImageURI(test.args)
|
||||
assert.Equal(t, test.expectErr, err != nil)
|
||||
assert.Equal(t, test.expect, got)
|
||||
|
@ -184,7 +188,9 @@ func TestResolveImageWithPrivateRegistry(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
got, err := resolveImageURI(test.args)
|
||||
assert.Equal(t, test.expectErr, err != nil)
|
||||
assert.Equal(t, test.expect, got)
|
||||
|
|
|
@ -33,6 +33,7 @@ func TestStandaloneInitNegatives(t *testing.T) {
|
|||
require.NoError(t, err, "expected no error on querying for os home dir")
|
||||
|
||||
t.Run("run without install", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
output, err := cmdRun("")
|
||||
require.Error(t, err, "expected error status on run without install")
|
||||
path := filepath.Join(homeDir, ".dapr", "components")
|
||||
|
@ -44,18 +45,21 @@ func TestStandaloneInitNegatives(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("list without install", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
output, err := cmdList("")
|
||||
require.NoError(t, err, "expected no error status on list without install")
|
||||
require.Equal(t, "No Dapr instances found.\n", output)
|
||||
})
|
||||
|
||||
t.Run("stop without install", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
output, err := cmdStopWithAppID("test")
|
||||
require.NoError(t, err, "expected no error on stop without install")
|
||||
require.Contains(t, output, "failed to stop app id test: couldn't find app id test", "expected output to match")
|
||||
})
|
||||
|
||||
t.Run("uninstall without install", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
output, err := cmdUninstall()
|
||||
require.NoError(t, err, "expected no error on uninstall without install")
|
||||
require.Contains(t, output, "Removing Dapr from your machine...", "expected output to contain message")
|
||||
|
|
|
@ -75,7 +75,9 @@ func TestContainerRuntimeUtils(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
actualValid := IsValidContainerRuntime(tc.input)
|
||||
if actualValid != tc.valid {
|
||||
t.Errorf("expected %v, got %v", tc.valid, actualValid)
|
||||
|
@ -117,7 +119,9 @@ func TestContains(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
actualValid := Contains(tc.input, tc.expected)
|
||||
if actualValid != tc.valid {
|
||||
t.Errorf("expected %v, got %v", tc.valid, actualValid)
|
||||
|
@ -160,7 +164,9 @@ func TestGetVersionAndImageVariant(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
version, imageVariant := GetVersionAndImageVariant(tc.input)
|
||||
assert.Equal(t, tc.expectedVersion, version)
|
||||
assert.Equal(t, tc.expectedImageVariant, imageVariant)
|
||||
|
@ -195,7 +201,9 @@ func TestValidateFilePaths(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
actual := ValidateFilePath(tc.input)
|
||||
assert.Equal(t, tc.expectedErr, actual != nil)
|
||||
})
|
||||
|
@ -235,7 +243,9 @@ func TestGetAbsPath(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
actual := GetAbsPath(baseDir, tc.input)
|
||||
assert.Equal(t, tc.expected, actual)
|
||||
})
|
||||
|
@ -262,7 +272,9 @@ func TestReadFile(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, actual := ReadFile(tc.input)
|
||||
assert.Equal(t, tc.expectedErr, actual != nil)
|
||||
})
|
||||
|
@ -323,7 +335,9 @@ func TestFindFileInDir(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
filePath, err := FindFileInDir(tc.input, "dapr.yaml")
|
||||
assert.Equal(t, tc.expectedErr, err != nil)
|
||||
assert.Equal(t, tc.expectedFilePath, filePath)
|
||||
|
@ -403,7 +417,9 @@ func TestPrintDetail(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
var buf bytes.Buffer
|
||||
err := PrintDetail(&buf, tc.format, tc.list)
|
||||
if tc.shouldError {
|
||||
|
|
Loading…
Reference in New Issue