ensuring non zero approvals

feature/basic_auth
Karolis Rusenas 2019-04-16 22:18:37 +01:00
parent 98378d54af
commit 6ce45cdf57
1 changed files with 3 additions and 13 deletions

View File

@ -452,7 +452,7 @@ func TestApprovalsWithAuthentication(t *testing.T) {
dep := &apps_v1.Deployment{
meta_v1.TypeMeta{},
meta_v1.ObjectMeta{
Name: "deployment-1",
Name: "dep-1-auth-test",
Namespace: testNamespace,
Labels: map[string]string{
types.KeelPolicyLabel: "all",
@ -513,8 +513,6 @@ func TestApprovalsWithAuthentication(t *testing.T) {
time.Sleep(2 * time.Second)
// req2, err := http.NewRequest("GET", "http://localhost:9300/v1/approvals", nil)
reqNoAuth, err := http.NewRequest("GET", "http://localhost:9300/v1/approvals", nil)
if err != nil {
t.Fatalf("failed to create req: %s", err)
@ -547,16 +545,8 @@ func TestApprovalsWithAuthentication(t *testing.T) {
t.Fatalf("failed to decode approvals resp: %s", err)
}
if len(approvals) != 1 {
t.Errorf("expected to find 1 approval, got: %d", len(approvals))
} else {
if approvals[0].VotesRequired != 1 {
t.Errorf("expected 1 required vote, got: %d", approvals[0].VotesRequired)
}
log.Infof("approvals deadline: %s, time since: %v", approvals[0].Deadline, time.Since(approvals[0].Deadline))
if time.Since(approvals[0].Deadline) > -4*time.Hour && time.Since(approvals[0].Deadline) < -5*time.Hour {
t.Errorf("deadline is for: %s", approvals[0].Deadline)
}
if len(approvals) == 0 {
t.Errorf("no approvals found")
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)