e2e: Continuous rolling-update of runners while workflow jobs are running

This should help revealing issues like https://github.com/actions-runner-controller/actions-runner-controller/issues/1535 if any.
This commit is contained in:
Yusuke Kuoka 2022-08-26 01:28:00 +00:00
parent 6ef276b239
commit ebcd838501
3 changed files with 52 additions and 3 deletions

View File

@ -49,6 +49,10 @@ spec:
labels: labels:
- "${RUNNER_LABEL}" - "${RUNNER_LABEL}"
env:
- name: ROLLING_UPDATE_PHASE
value: "${ROLLING_UPDATE_PHASE}"
# #
# Non-standard working directory # Non-standard working directory
# #

View File

@ -121,6 +121,8 @@ spec:
value: "${RUNNER_FEATURE_FLAG_EPHEMERAL}" value: "${RUNNER_FEATURE_FLAG_EPHEMERAL}"
- name: GOMODCACHE - name: GOMODCACHE
value: "/home/runner/.cache/go-mod" value: "/home/runner/.cache/go-mod"
- name: ROLLING_UPDATE_PHASE
value: "${ROLLING_UPDATE_PHASE}"
# PV-backed runner work dir # PV-backed runner work dir
volumeMounts: volumeMounts:
# Comment out the ephemeral work volume if you're going to test the kubernetes container mode # Comment out the ephemeral work volume if you're going to test the kubernetes container mode

View File

@ -205,6 +205,27 @@ func TestE2E(t *testing.T) {
} }
} }
ctx, cancel := context.WithCancel(context.Background())
go func() {
for i := 1; ; i++ {
select {
case _, ok := <-ctx.Done():
if !ok {
t.Logf("Stopping the continuous rolling-update of runners")
}
default:
time.Sleep(10 * time.Second)
t.Run(fmt.Sprintf("update runners attempt %d", i), func(t *testing.T) {
env.deploy(t, RunnerSets, testID, fmt.Sprintf("ROLLING_UPDATE_PHASE=%d", i))
})
}
}
}()
t.Cleanup(func() {
cancel()
})
t.Run("Install workflow", func(t *testing.T) { t.Run("Install workflow", func(t *testing.T) {
env.installActionsWorkflow(t, RunnerSets, testID) env.installActionsWorkflow(t, RunnerSets, testID)
}) })
@ -280,6 +301,27 @@ func TestE2E(t *testing.T) {
} }
} }
ctx, cancel := context.WithCancel(context.Background())
go func() {
for i := 1; ; i++ {
select {
case _, ok := <-ctx.Done():
if !ok {
t.Logf("Stopping the continuous rolling-update of runners")
}
default:
time.Sleep(10 * time.Second)
t.Run(fmt.Sprintf("update runners - attempt %d", i), func(t *testing.T) {
env.deploy(t, RunnerDeployments, testID, fmt.Sprintf("ROLLING_UPDATE_PHASE=%d", i))
})
}
}
}()
t.Cleanup(func() {
cancel()
})
t.Run("Install workflow", func(t *testing.T) { t.Run("Install workflow", func(t *testing.T) {
env.installActionsWorkflow(t, RunnerDeployments, testID) env.installActionsWorkflow(t, RunnerDeployments, testID)
}) })
@ -628,9 +670,9 @@ func (e *env) installActionsRunnerController(t *testing.T, repo, tag, testID, ch
e.RunScript(t, "../../acceptance/deploy.sh", testing.ScriptConfig{Dir: "../..", Env: scriptEnv}) e.RunScript(t, "../../acceptance/deploy.sh", testing.ScriptConfig{Dir: "../..", Env: scriptEnv})
} }
func (e *env) deploy(t *testing.T, kind DeployKind, testID string) { func (e *env) deploy(t *testing.T, kind DeployKind, testID string, env ...string) {
t.Helper() t.Helper()
e.do(t, "apply", kind, testID) e.do(t, "apply", kind, testID, env...)
} }
func (e *env) undeploy(t *testing.T, kind DeployKind, testID string) { func (e *env) undeploy(t *testing.T, kind DeployKind, testID string) {
@ -638,7 +680,7 @@ func (e *env) undeploy(t *testing.T, kind DeployKind, testID string) {
e.do(t, "delete", kind, testID) e.do(t, "delete", kind, testID)
} }
func (e *env) do(t *testing.T, op string, kind DeployKind, testID string) { func (e *env) do(t *testing.T, op string, kind DeployKind, testID string, env ...string) {
t.Helper() t.Helper()
e.createControllerNamespaceAndServiceAccount(t) e.createControllerNamespaceAndServiceAccount(t)
@ -649,6 +691,7 @@ func (e *env) do(t *testing.T, op string, kind DeployKind, testID string) {
"RUNNER_NAMESPACE=" + e.runnerNamespace, "RUNNER_NAMESPACE=" + e.runnerNamespace,
"RUNNER_SERVICE_ACCOUNT_NAME=" + e.runnerServiceAccuontName, "RUNNER_SERVICE_ACCOUNT_NAME=" + e.runnerServiceAccuontName,
} }
scriptEnv = append(scriptEnv, env...)
switch kind { switch kind {
case RunnerSets: case RunnerSets: