-
Notifications
You must be signed in to change notification settings - Fork 304
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
add more neg tests #829
add more neg tests #829
Conversation
65b6f94
to
6bd623a
Compare
cmd/e2e-test/neg_test.go
Outdated
port80 := intstr.FromInt(80) | ||
|
||
ctx := context.Background() | ||
numForwardingRules := 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
cmd/e2e-test/neg_test.go
Outdated
} | ||
|
||
scaleAndValidate(2) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need newlines here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this sequence? is there something specific that is being tested here (document in a comment)
pkg/e2e/helpers.go
Outdated
|
||
// CheckDistinctResponseHost issue GET call to the vip for 100 times, parse the reponses and calculate the number of distinct backends. | ||
func CheckDistinctResponseHost(vip string, expectDistinctHosts int, tolerateTransientError bool) error { | ||
errs := []error{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var errs []error
pkg/e2e/helpers.go
Outdated
// CheckDistinctResponseHost issue GET call to the vip for 100 times, parse the reponses and calculate the number of distinct backends. | ||
func CheckDistinctResponseHost(vip string, expectDistinctHosts int, tolerateTransientError bool) error { | ||
errs := []error{} | ||
repeat := 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
pkg/e2e/helpers.go
Outdated
} | ||
wantedReplicas := *deployment.Spec.Replicas | ||
|
||
if deployment.Status.Replicas != wantedReplicas { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could do to avoid mismatches
for _, f := range []struct{
v *int
name string
want int
}{
{&deployment.Status.Replicas, "replicas", wantedReplicas},
{&deployment.Status.ReadyReplicas, "ready replicas", wantedReplicas},
{&deployment.Status.AvailabledReplicas, "available replicas", wantedReplicas},
{&deployment.Status.UpdatedReplicas, "updated replicas", wantedReplicas},
...
}{
if *f.v != f.want {
return fmt.Errorf("deployment %s/%s has %d %s, want %d", deployment.Namespace, deployment.Name, *f.v, f.name, f.want)
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
Fixed. Ready for another round. |
pkg/e2e/fixtures.go
Outdated
@@ -189,3 +236,16 @@ func DeleteGCPAddress(s *Sandbox, name string) error { | |||
|
|||
return nil | |||
} | |||
|
|||
func GetNegStatus(s *Sandbox, name string) (annotations.NegStatus, bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems weird to return both bool and error?
pkg/e2e/helpers.go
Outdated
} | ||
|
||
if deployment.Status.UnavailableReplicas != 0 { | ||
return fmt.Errorf("deployment %s/%s has %v unavailable replicas, want 0", deployment.Namespace, deployment.Name, deployment.Status.UnavailableReplicas) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this would just be?
{&deployment.Status.UnavailableReplicas, "unavailable replicas", 0},
pkg/e2e/helpers.go
Outdated
|
||
// CheckNegs checks if the network endpoints in the NEGs is in expected state | ||
func CheckNegs(negs map[meta.Key]*fuzz.NetworkEndpoints, expectHealthy bool, expectCount int) error { | ||
count := 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var (
count int
errs []error
negNames []string
)
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bowei, freehan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
migrate part of the test from OSS k8s