From 83760ed7059641f5a188a2c6e32bacfbb6a4254c Mon Sep 17 00:00:00 2001 From: lamai93 Date: Wed, 24 Oct 2018 15:40:46 +0200 Subject: [PATCH 1/2] Fixed readiness route. --- pkg/deployment/resources/pod_creator.go | 2 +- tests/upgrade_test.go | 45 +++++++++++++++---------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/pkg/deployment/resources/pod_creator.go b/pkg/deployment/resources/pod_creator.go index 6a5f0ea41..683a5d14b 100644 --- a/pkg/deployment/resources/pod_creator.go +++ b/pkg/deployment/resources/pod_creator.go @@ -369,7 +369,7 @@ func (r *Resources) createReadinessProbe(spec api.DeploymentSpec, group api.Serv } } probeCfg := &k8sutil.HTTPProbeConfig{ - LocalPath: "/_api/version", + LocalPath: "/_admin/server/availability", Secure: spec.IsSecure(), Authorization: authorization, InitialDelaySeconds: 2, diff --git a/tests/upgrade_test.go b/tests/upgrade_test.go index f6d8e3b4c..f08f2c3d9 100644 --- a/tests/upgrade_test.go +++ b/tests/upgrade_test.go @@ -27,16 +27,19 @@ import ( "strings" "testing" - "github.com/dchest/uniuri" - api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha" kubeArangoClient "github.com/arangodb/kube-arangodb/pkg/client" "github.com/arangodb/kube-arangodb/pkg/util" + "github.com/dchest/uniuri" ) +func TestUpgradeClusterRocksDB33pto34p(t *testing.T) { + upgradeSubTest(t, api.DeploymentModeCluster, api.StorageEngineRocksDB, "arangodb/arangodb-preview:3.3", "arangodb/arangodb-preview:3.4") +} + // test upgrade single server mmfiles 3.2 -> 3.3 func TestUpgradeSingleMMFiles32to33(t *testing.T) { - upgradeSubTest(t, api.DeploymentModeSingle, api.StorageEngineMMFiles, "3.2.16", "3.3.13") + upgradeSubTest(t, api.DeploymentModeSingle, api.StorageEngineMMFiles, "arangodb/arangodb:3.2.16", "arangodb/arangodb:3.3.13") } // // test upgrade single server rocksdb 3.3 -> 3.4 @@ -64,22 +67,22 @@ func TestUpgradeClusterRocksDB32to33(t *testing.T) { // upgradeSubTest(t, api.DeploymentModeCluster, api.StorageEngineRocksDB, "3.3.13", "3.4.0") // } -// test downgrade single server mmfiles 3.3.13 -> 3.3.12 -func TestDowngradeSingleMMFiles333to332(t *testing.T) { - upgradeSubTest(t, api.DeploymentModeSingle, api.StorageEngineMMFiles, "3.3.13", "3.3.12") +// test downgrade single server mmfiles 3.3.17 -> 3.3.16 +func TestDowngradeSingleMMFiles3317to3316(t *testing.T) { + upgradeSubTest(t, api.DeploymentModeSingle, api.StorageEngineMMFiles, "arangodb/arangodb:3.3.16", "arangodb/arangodb:3.3.17") } -// test downgrade ActiveFailover server rocksdb 3.3.13 -> 3.3.12 -func TestDowngradeActiveFailoverRocksDB333to332(t *testing.T) { - upgradeSubTest(t, api.DeploymentModeActiveFailover, api.StorageEngineRocksDB, "3.3.13", "3.3.12") +// test downgrade ActiveFailover server rocksdb 3.3.17 -> 3.3.16 +func TestDowngradeActiveFailoverRocksDB3317to3316(t *testing.T) { + upgradeSubTest(t, api.DeploymentModeActiveFailover, api.StorageEngineRocksDB, "arangodb/arangodb:3.3.16", "arangodb/arangodb:3.3.17") } -// test downgrade cluster rocksdb 3.3.13 -> 3.3.12 -func TestDowngradeClusterRocksDB332to332(t *testing.T) { - upgradeSubTest(t, api.DeploymentModeCluster, api.StorageEngineRocksDB, "3.3.13", "3.3.12") +// test downgrade cluster rocksdb 3.3.17 -> 3.3.16 +func TestDowngradeClusterRocksDB3317to3316(t *testing.T) { + upgradeSubTest(t, api.DeploymentModeCluster, api.StorageEngineRocksDB, "arangodb/arangodb:3.3.16", "arangodb/arangodb:3.3.17") } -func upgradeSubTest(t *testing.T, mode api.DeploymentMode, engine api.StorageEngine, fromVersion, toVersion string) error { +func upgradeSubTest(t *testing.T, mode api.DeploymentMode, engine api.StorageEngine, fromImage, toImage string) error { // check environment longOrSkip(t) @@ -87,11 +90,11 @@ func upgradeSubTest(t *testing.T, mode api.DeploymentMode, engine api.StorageEng kubecli := mustNewKubeClient(t) c := kubeArangoClient.MustNewInCluster() - depl := newDeployment(strings.Replace(fmt.Sprintf("tu-%s-%s-%st%s-%s", mode[:2], engine[:2], fromVersion, toVersion, uniuri.NewLen(4)), ".", "", -1)) + depl := newDeployment(strings.Replace(fmt.Sprintf("tu-%s-%s-%s", mode[:2], engine[:2], uniuri.NewLen(4)), ".", "", -1)) depl.Spec.Mode = api.NewMode(mode) depl.Spec.StorageEngine = api.NewStorageEngine(engine) depl.Spec.TLS = api.TLSSpec{} // should auto-generate cert - depl.Spec.Image = util.NewString("arangodb/arangodb:" + fromVersion) + depl.Spec.Image = util.NewString(fromImage) depl.Spec.SetDefaults(depl.GetName()) // this must be last // Create deployment @@ -118,19 +121,25 @@ func upgradeSubTest(t *testing.T, mode api.DeploymentMode, engine api.StorageEng // Try to change image version deployment, err = updateDeployment(c, depl.GetName(), ns, func(spec *api.DeploymentSpec) { - spec.Image = util.NewString("arangodb/arangodb:" + toVersion) + spec.Image = util.NewString(toImage) }) if err != nil { - t.Fatalf("Failed to upgrade the Image from version : " + fromVersion + " to version: " + toVersion) + t.Fatalf("Failed to upgrade the Image from version : " + fromImage + " to version: " + toImage) + } else { + t.Log("Updated deployment") } deployment, err = waitUntilDeployment(c, depl.GetName(), ns, deploymentIsReady()) if err != nil { t.Fatalf("Deployment not running in time: %v", err) + } else { + t.Log("Deployment running") } - if err := waitUntilArangoDeploymentHealthy(deployment, DBClient, kubecli, toVersion); err != nil { + if err := waitUntilArangoDeploymentHealthy(deployment, DBClient, kubecli, toImage); err != nil { t.Fatalf("Deployment not healthy in time: %v", err) + } else { + t.Log("Deployment healthy") } // Cleanup From d464dc1850759d8cb0a22f655174977d8564bac6 Mon Sep 17 00:00:00 2001 From: lamai93 Date: Fri, 26 Oct 2018 13:15:50 +0200 Subject: [PATCH 2/2] When doing tests, always pull the image. --- tests/test_util.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_util.go b/tests/test_util.go index 816ce9436..0a4276e78 100644 --- a/tests/test_util.go +++ b/tests/test_util.go @@ -257,6 +257,9 @@ func newDeployment(name string) *api.ArangoDeployment { ObjectMeta: metav1.ObjectMeta{ Name: strings.ToLower(name), }, + Spec: api.DeploymentSpec{ + ImagePullPolicy: util.NewPullPolicy(v1.PullAlways), + }, } // set default image to the value given in env