Skip to content

Commit 03d190a

Browse files
Merge branch 'master' into feat/resources_dir
2 parents a4c5f81 + abe9680 commit 03d190a

File tree

7 files changed

+201
-103
lines changed

7 files changed

+201
-103
lines changed

.github/workflows/kind_e2e.yaml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ jobs:
5151
runs-on: ubuntu-latest
5252
env:
5353
GOVER: 1.19.3
54-
DAPR_RUNTIME_VERSION: 1.9.4
55-
DAPR_DASHBOARD_VERSION: 0.11.0
56-
DAPR_TGZ: dapr-1.9.0.tgz
54+
DAPR_RUNTIME_PINNED_VERSION: 1.9.4
55+
DAPR_DASHBOARD_PINNED_VERSION: 0.11.0
56+
DAPR_RUNTIME_LATEST_VERSION:
57+
DAPR_DASHBOARD_LATEST_VERSION:
58+
DAPR_TGZ: dapr-1.9.4.tgz
5759
strategy:
5860
fail-fast: false # Keep running if one leg fails.
5961
matrix:
@@ -130,25 +132,35 @@ jobs:
130132
run: |
131133
docker image prune -a -f
132134
- name: Determine latest Dapr Runtime version including Pre-releases
133-
if: github.base_ref == 'master'
134135
run: |
135136
export RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
136137
if [[ -z "$RUNTIME_VERSION" ]]; then
137-
echo "Could not fetch the latest Dapr Runtime version. Using default version $DAPR_RUNTIME_VERSION"
138+
echo "Could not fetch the latest Dapr Runtime version. Using default version $DAPR_RUNTIME_PINNED_VERSION"
139+
echo "DAPR_RUNTIME_LATEST_VERSION=$DAPR_RUNTIME_PINNED_VERSION" >> $GITHUB_ENV
138140
else
139-
echo "DAPR_RUNTIME_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
140141
echo "Found $RUNTIME_VERSION"
142+
echo "DAPR_RUNTIME_LATEST_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
143+
base_ref=${{ github.base_ref }}
144+
echo "Branch $base_ref"
145+
if [[ $base_ref = 'master' ]]; then
146+
echo "DAPR_RUNTIME_PINNED_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
147+
fi
141148
fi
142149
shell: bash
143150
- name: Determine latest Dapr Dashboard version including Pre-releases
144-
if: github.base_ref == 'master'
145151
run: |
146152
export DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
147153
if [[ -z "$DASHBOARD_VERSION" ]]; then
148-
echo "Could not fetch the latest Dapr Dashboard version. Using default version $DAPR_DASHBOARD_VERSION"
154+
echo "Could not fetch the latest Dapr Dashboard version. Using default version $DAPR_DASHBOARD_PINNED_VERSION"
155+
echo "DAPR_DASHBOARD_LATEST_VERSION=$DAPR_DASHBOARD_PINNED_VERSION" >> $GITHUB_ENV
149156
else
150-
echo "DAPR_DASHBOARD_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
151157
echo "Found $DASHBOARD_VERSION"
158+
echo "DAPR_DASHBOARD_LATEST_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
159+
base_ref=${{ github.base_ref }}
160+
echo "Branch $base_ref"
161+
if [[ $base_ref = 'master' ]]; then
162+
echo "DAPR_DASHBOARD_PINNED_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
163+
fi
152164
fi
153165
shell: bash
154166
- name: Run tests with GHCR

.github/workflows/self_hosted_e2e.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ jobs:
4040
GOARCH: ${{ matrix.target_arch }}
4141
GOPROXY: https://proxy.golang.org
4242
ARCHIVE_OUTDIR: dist/archives
43-
DAPR_RUNTIME_VERSION: "1.9.4"
44-
DAPR_DASHBOARD_VERSION: 0.11.0
43+
DAPR_RUNTIME_PINNED_VERSION: "1.9.4"
44+
DAPR_DASHBOARD_PINNED_VERSION: 0.11.0
45+
DAPR_RUNTIME_LATEST_VERSION:
46+
DAPR_DASHBOARD_LATEST_VERSION:
4547
strategy:
4648
matrix:
4749
os: [macos-latest, ubuntu-latest, windows-latest]
@@ -77,25 +79,35 @@ jobs:
7779
podman machine start
7880
echo "CONTAINER_RUNTIME=podman" >> $GITHUB_ENV
7981
- name: Determine latest Dapr Runtime version including Pre-releases
80-
if: github.base_ref == 'master'
8182
run: |
8283
export RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
8384
if [[ -z "$RUNTIME_VERSION" ]]; then
84-
echo "Could not fetch the latest Dapr Runtime version. Using default version $DAPR_RUNTIME_VERSION"
85+
echo "Could not fetch the latest Dapr Runtime version. Using default version $DAPR_RUNTIME_PINNED_VERSION"
86+
echo "DAPR_RUNTIME_LATEST_VERSION=$DAPR_RUNTIME_PINNED_VERSION" >> $GITHUB_ENV
8587
else
86-
echo "DAPR_RUNTIME_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
8788
echo "Found $RUNTIME_VERSION"
89+
echo "DAPR_RUNTIME_LATEST_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
90+
base_ref=${{ github.base_ref }}
91+
echo "Branch $base_ref"
92+
if [[ $base_ref = 'master' ]]; then
93+
echo "DAPR_RUNTIME_PINNED_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
94+
fi
8895
fi
8996
shell: bash
9097
- name: Determine latest Dapr Dashboard version including Pre-releases
91-
if: github.base_ref == 'master'
9298
run: |
9399
export DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
94100
if [[ -z "$DASHBOARD_VERSION" ]]; then
95-
echo "Could not fetch the latest Dapr Dashboard version. Using default version $DAPR_DASHBOARD_VERSION"
101+
echo "Could not fetch the latest Dapr Dashboard version. Using default version $DAPR_DASHBOARD_PINNED_VERSION"
102+
echo "DAPR_DASHBOARD_LATEST_VERSION=$DAPR_DASHBOARD_PINNED_VERSION" >> $GITHUB_ENV
96103
else
97-
echo "DAPR_DASHBOARD_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
98104
echo "Found $DASHBOARD_VERSION"
105+
echo "DAPR_DASHBOARD_LATEST_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
106+
base_ref=${{ github.base_ref }}
107+
echo "Branch $base_ref"
108+
if [[ $base_ref = 'master' ]]; then
109+
echo "DAPR_DASHBOARD_PINNED_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
110+
fi
99111
fi
100112
shell: bash
101113
- name: Run E2E tests with GHCR

tests/e2e/common/common.go

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ const (
5050
)
5151

5252
type VersionDetails struct {
53-
RuntimeVersion string
54-
DashboardVersion string
55-
ImageVariant string
56-
CustomResourceDefs []string
57-
ClusterRoles []string
58-
ClusterRoleBindings []string
53+
RuntimeVersion string
54+
DashboardVersion string
55+
ImageVariant string
56+
CustomResourceDefs []string
57+
ClusterRoles []string
58+
ClusterRoleBindings []string
59+
UseDaprLatestVersion bool
5960
}
6061

6162
type TestOptions struct {
@@ -71,20 +72,26 @@ type TestCase struct {
7172
Callable func(*testing.T)
7273
}
7374

74-
// GetVersionsFromEnv will return values from required environment variables,
75+
// GetVersionsFromEnv will return values from required environment variables.
76+
// parameter `latest` is used to determine if the latest versions of dapr & dashboard should be used.
7577
// if environment variables are not set it fails the test.
76-
func GetVersionsFromEnv(t *testing.T) (string, string) {
78+
func GetVersionsFromEnv(t *testing.T, latest bool) (string, string) {
7779
var daprRuntimeVersion, daprDashboardVersion string
78-
79-
if runtimeVersion, ok := os.LookupEnv("DAPR_RUNTIME_VERSION"); ok {
80+
runtimeEnvVar := "DAPR_RUNTIME_PINNED_VERSION"
81+
dashboardEnvVar := "DAPR_DASHBOARD_PINNED_VERSION"
82+
if latest {
83+
runtimeEnvVar = "DAPR_RUNTIME_LATEST_VERSION"
84+
dashboardEnvVar = "DAPR_DASHBOARD_LATEST_VERSION"
85+
}
86+
if runtimeVersion, ok := os.LookupEnv(runtimeEnvVar); ok {
8087
daprRuntimeVersion = runtimeVersion
8188
} else {
82-
t.Fatalf("env var \"DAPR_RUNTIME_VERSION\" not set")
89+
t.Fatalf("env var \"%s\" not set", runtimeEnvVar)
8390
}
84-
if dashboardVersion, ok := os.LookupEnv("DAPR_DASHBOARD_VERSION"); ok {
91+
if dashboardVersion, ok := os.LookupEnv(dashboardEnvVar); ok {
8592
daprDashboardVersion = dashboardVersion
8693
} else {
87-
t.Fatalf("env var \"DAPR_DASHBOARD_VERSION\" not set")
94+
t.Fatalf("env var \"%s\" not set", dashboardEnvVar)
8895
}
8996
return daprRuntimeVersion, daprDashboardVersion
9097
}
@@ -182,6 +189,27 @@ func GetTestsOnUninstall(details VersionDetails, opts TestOptions) []TestCase {
182189
}
183190
}
184191

192+
func GetTestForCertRenewal(currentVersionDetails VersionDetails, installOpts TestOptions) []TestCase {
193+
tests := []TestCase{}
194+
tests = append(tests, []TestCase{
195+
{"Renew certificate which expires in less than 30 days", GenerateNewCertAndRenew(currentVersionDetails, installOpts)},
196+
}...)
197+
tests = append(tests, GetTestsPostCertificateRenewal(currentVersionDetails, installOpts)...)
198+
tests = append(tests, []TestCase{
199+
{"Cert Expiry warning message check " + currentVersionDetails.RuntimeVersion, CheckMTLSStatus(currentVersionDetails, installOpts, true)},
200+
}...)
201+
202+
// tests for certificate renewal with provided certificates.
203+
tests = append(tests, []TestCase{
204+
{"Renew certificate which expires in after 30 days", UseProvidedNewCertAndRenew(currentVersionDetails, installOpts)},
205+
}...)
206+
tests = append(tests, GetTestsPostCertificateRenewal(currentVersionDetails, installOpts)...)
207+
tests = append(tests, []TestCase{
208+
{"Cert Expiry no warning message check " + currentVersionDetails.RuntimeVersion, CheckMTLSStatus(currentVersionDetails, installOpts, false)},
209+
}...)
210+
return tests
211+
}
212+
185213
func GetTestsPostCertificateRenewal(details VersionDetails, opts TestOptions) []TestCase {
186214
return []TestCase{
187215
{"crds exist " + details.RuntimeVersion, CRDTest(details, opts)},
@@ -475,6 +503,9 @@ func UseProvidedPrivateKeyAndRenewCerts(details VersionDetails, opts TestOptions
475503
"--private-key", "../testdata/example-root.key",
476504
"--valid-until", "20",
477505
}
506+
if details.ImageVariant != "" {
507+
args = append(args, "--image-variant", details.ImageVariant)
508+
}
478509
output, err := spawn.Command(daprPath, args...)
479510
t.Log(output)
480511
require.NoError(t, err, "expected no error on certificate renewal")
@@ -505,6 +536,9 @@ func UseProvidedNewCertAndRenew(details VersionDetails, opts TestOptions) func(t
505536
"--issuer-public-certificate", "./certs/issuer.crt",
506537
"--restart",
507538
}
539+
if details.ImageVariant != "" {
540+
args = append(args, "--image-variant", details.ImageVariant)
541+
}
508542
output, err := spawn.Command(daprPath, args...)
509543
t.Log(output)
510544
require.NoError(t, err, "expected no error on certificate renewal")
@@ -671,9 +705,11 @@ func installTest(details VersionDetails, opts TestOptions) func(t *testing.T) {
671705
"init", "-k",
672706
"--wait",
673707
"-n", DaprTestNamespace,
674-
"--runtime-version", details.RuntimeVersion,
675708
"--log-as-json",
676709
}
710+
if !details.UseDaprLatestVersion {
711+
args = append(args, "--runtime-version", details.RuntimeVersion)
712+
}
677713
if opts.HAEnabled {
678714
args = append(args, "--enable-ha")
679715
}

0 commit comments

Comments
 (0)