Cover ARC upgrade in E2E test (#1592)

* Cover ARC upgrade in E2E test

so that we can make it extra sure that you can upgrade the existing installation of ARC to the next and also (hopefully) it is backward-compatible, or at least it does not break immediately after upgrading.

* Consolidate E2E tests for RS and RD

* Fix E2E for RD to pass

* Add some comment in E2E for how to release disk consumed after dozens of test runs
This commit is contained in:
Yusuke Kuoka
2022-07-01 21:32:05 +09:00
committed by GitHub
parent d62c8a4697
commit 4446ba57e1
5 changed files with 296 additions and 168 deletions

View File

@@ -86,6 +86,16 @@ func (k *Kubectl) CreateCMLiterals(ctx context.Context, name string, literals ma
return nil
}
func (k *Kubectl) DeleteCM(ctx context.Context, name string, cfg KubectlConfig) error {
args := []string{"cm", name}
if _, err := k.CombinedOutput(k.kubectlCmd(ctx, "delete", args, cfg)); err != nil {
return err
}
return nil
}
func (k *Kubectl) Apply(ctx context.Context, path string, cfg KubectlConfig) error {
if _, err := k.CombinedOutput(k.kubectlCmd(ctx, "apply", []string{"-f", path}, cfg)); err != nil {
return err

View File

@@ -32,7 +32,6 @@ type Env struct {
docker *Docker
Kubectl *Kubectl
bash *Bash
id string
}
func Start(t *testing.T, opts ...Option) *Env {
@@ -56,7 +55,11 @@ func Start(t *testing.T, opts ...Option) *Env {
env.bash = bash
//
return &env
}
func (e *Env) GetOrGenerateTestID(t *testing.T) string {
k, kctl := e.kind, e.Kubectl
cmKey := "id"
@@ -82,13 +85,27 @@ func Start(t *testing.T, opts ...Option) *Env {
}
}
env.id = m[cmKey]
return &env
return m[cmKey]
}
func (e *Env) ID() string {
return e.id
func (e *Env) DeleteTestID(t *testing.T) {
k, kctl := e.kind, e.Kubectl
kubectlEnv := []string{
"KUBECONFIG=" + k.Kubeconfig(),
}
cmCfg := KubectlConfig{
Env: kubectlEnv,
}
testInfoName := "test-info"
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)
defer cancel()
if err := kctl.DeleteCM(ctx, testInfoName, cmCfg); err != nil {
t.Fatal(err)
}
}
func (e *Env) DockerBuild(t *testing.T, builds []DockerBuild) {