Skip to content
Permalink
Browse files

Use expect equal test/e2e/upgrades

  • Loading branch information
tanjunchen committed Dec 2, 2019
1 parent b920b38 commit 0c36299c218268be084cb4c056ce2522588bae2a
Showing with 8 additions and 12 deletions.
  1. +3 −4 test/e2e/upgrades/cassandra.go
  2. +3 −4 test/e2e/upgrades/etcd.go
  3. +1 −2 test/e2e/upgrades/mysql.go
  4. +1 −2 test/e2e/upgrades/nvidia-gpu.go
@@ -26,7 +26,6 @@ import (
"time"

"github.com/onsi/ginkgo"
"github.com/onsi/gomega"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/version"
@@ -200,19 +199,19 @@ func (t *CassandraUpgradeTest) Test(f *framework.Framework, done <-chan struct{}
}, 10*time.Millisecond, done)
framework.Logf("got %d users; want >=%d", lastUserCount, t.successfulWrites)

gomega.Expect(lastUserCount >= t.successfulWrites).To(gomega.BeTrue())
framework.ExpectEqual(lastUserCount >= t.successfulWrites, true)
ratio := float64(success) / float64(success+failures)
framework.Logf("Successful gets %d/%d=%v", success, success+failures, ratio)
ratio = float64(t.successfulWrites) / float64(writeAttempts)
framework.Logf("Successful writes %d/%d=%v", t.successfulWrites, writeAttempts, ratio)
framework.Logf("Errors: %v", errors)
// TODO(maisem): tweak this value once we have a few test runs.
gomega.Expect(ratio > 0.75).To(gomega.BeTrue())
framework.ExpectEqual(ratio > 0.75, true)
}

// Teardown does one final check of the data's availability.
func (t *CassandraUpgradeTest) Teardown(f *framework.Framework) {
users, err := t.listUsers()
framework.ExpectNoError(err)
gomega.Expect(len(users) >= t.successfulWrites).To(gomega.BeTrue())
framework.ExpectEqual(len(users) >= t.successfulWrites, true)
}
@@ -26,7 +26,6 @@ import (
"time"

"github.com/onsi/ginkgo"
"github.com/onsi/gomega"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/version"
@@ -188,19 +187,19 @@ func (t *EtcdUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upg
}, 10*time.Millisecond, done)
framework.Logf("got %d users; want >=%d", lastUserCount, t.successfulWrites)

gomega.Expect(lastUserCount >= t.successfulWrites).To(gomega.BeTrue())
framework.ExpectEqual(lastUserCount >= t.successfulWrites, true)
ratio := float64(success) / float64(success+failures)
framework.Logf("Successful gets %d/%d=%v", success, success+failures, ratio)
ratio = float64(t.successfulWrites) / float64(writeAttempts)
framework.Logf("Successful writes %d/%d=%v", t.successfulWrites, writeAttempts, ratio)
framework.Logf("Errors: %v", errors)
// TODO(maisem): tweak this value once we have a few test runs.
gomega.Expect(ratio > 0.75).To(gomega.BeTrue())
framework.ExpectEqual(ratio > 0.75, true)
}

// Teardown does one final check of the data's availability.
func (t *EtcdUpgradeTest) Teardown(f *framework.Framework) {
users, err := t.listUsers()
framework.ExpectNoError(err)
gomega.Expect(len(users) >= t.successfulWrites).To(gomega.BeTrue())
framework.ExpectEqual(len(users) >= t.successfulWrites, true)
}
@@ -26,7 +26,6 @@ import (
"time"

"github.com/onsi/ginkgo"
"github.com/onsi/gomega"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/version"
@@ -168,7 +167,7 @@ func (t *MySQLUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, up
func (t *MySQLUpgradeTest) Teardown(f *framework.Framework) {
count, err := t.countNames()
framework.ExpectNoError(err)
gomega.Expect(count >= t.successfulWrites).To(gomega.BeTrue())
framework.ExpectEqual(count >= t.successfulWrites, true)
}

// addName adds a new value to the db.
@@ -22,7 +22,6 @@ import (
"k8s.io/kubernetes/test/e2e/scheduling"

"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
)

const (
@@ -54,7 +53,7 @@ func (t *NvidiaGPUUpgradeTest) Test(f *framework.Framework, done <-chan struct{}
// MasterUpgrade should be totally hitless.
job, err := jobutil.GetJob(f.ClientSet, f.Namespace.Name, "cuda-add")
framework.ExpectNoError(err)
gomega.Expect(job.Status.Failed).To(gomega.BeZero(), "Job pods failed during master upgrade: %v", job.Status.Failed)
framework.ExpectEqual(job.Status.Failed, 0, "Job pods failed during master upgrade: %v", job.Status.Failed)
}
}

0 comments on commit 0c36299

Please sign in to comment.
You can’t perform that action at this time.