Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use expect equal test e2e upgrades #85781

Merged
merged 1 commit into from Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions test/e2e/upgrades/cassandra.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
7 changes: 3 additions & 4 deletions test/e2e/upgrades/etcd.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
3 changes: 1 addition & 2 deletions test/e2e/upgrades/mysql.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/upgrades/nvidia-gpu.go
Expand Up @@ -22,7 +22,6 @@ import (
"k8s.io/kubernetes/test/e2e/scheduling"

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

const (
Expand Down Expand Up @@ -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)
}
}

Expand Down