Changed code to improve output for files under test/e2e/upgrades/apps

This commit is contained in:
Nikhil Sharma 2021-10-27 11:41:18 +05:30
parent fa6bb7cad0
commit 031dc016e6
3 changed files with 10 additions and 9 deletions

View File

@ -27,6 +27,7 @@ import (
"time"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/version"
@ -204,20 +205,19 @@ func (t *CassandraUpgradeTest) Test(f *framework.Framework, done <-chan struct{}
lastUserCount = len(users)
}, 10*time.Millisecond, done)
framework.Logf("got %d users; want >=%d", lastUserCount, t.successfulWrites)
framework.ExpectEqual(lastUserCount >= t.successfulWrites, true)
gomega.Expect(lastUserCount).To(gomega.BeNumerically(">=", t.successfulWrites), "lastUserCount is too small")
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.
framework.ExpectEqual(ratio > 0.75, true)
gomega.Expect(ratio).To(gomega.BeNumerically(">", 0.75), "ratio too small")
}
// Teardown does one final check of the data's availability.
func (t *CassandraUpgradeTest) Teardown(f *framework.Framework) {
users, err := t.listUsers()
framework.ExpectNoError(err)
framework.ExpectEqual(len(users) >= t.successfulWrites, true)
gomega.Expect(len(users)).To(gomega.BeNumerically(">=", t.successfulWrites), "len(users) is too small")
}

View File

@ -27,6 +27,7 @@ import (
"time"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/version"
@ -192,20 +193,19 @@ func (t *EtcdUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upg
lastUserCount = len(users)
}, 10*time.Millisecond, done)
framework.Logf("got %d users; want >=%d", lastUserCount, t.successfulWrites)
framework.ExpectEqual(lastUserCount >= t.successfulWrites, true)
gomega.Expect(lastUserCount).To(gomega.BeNumerically(">=", t.successfulWrites), "lastUserCount is too small")
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.
framework.ExpectEqual(ratio > 0.75, true)
gomega.Expect(ratio).To(gomega.BeNumerically(">", 0.75), "ratio too small")
}
// Teardown does one final check of the data's availability.
func (t *EtcdUpgradeTest) Teardown(f *framework.Framework) {
users, err := t.listUsers()
framework.ExpectNoError(err)
framework.ExpectEqual(len(users) >= t.successfulWrites, true)
gomega.Expect(len(users)).To(gomega.BeNumerically(">=", t.successfulWrites), "len(users) is too small")
}

View File

@ -27,6 +27,7 @@ import (
"time"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/version"
@ -173,7 +174,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)
framework.ExpectEqual(count >= t.successfulWrites, true)
gomega.Expect(count).To(gomega.BeNumerically(">=", t.successfulWrites), "count is too small")
}
// addName adds a new value to the db.