Repository navigation
Expand file tree
/
Copy pathinstall.go
More file actions
54 lines (49 loc) · 1.49 KB
/
Copy pathinstall.go
File metadata and controls
54 lines (49 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package testutil
import (
"context"
"fmt"
"testing"
)
// TestResourcesPostInstall tests resources post control plane installation
func TestResourcesPostInstall(namespace string, services []Service, deploys map[string]DeploySpec, h *TestHelper, t *testing.T) {
t.Helper()
ctx := context.Background()
// Tests Namespace
err := h.CheckIfNamespaceExists(ctx, namespace)
if err != nil {
AnnotatedFatalf(t, "received unexpected output",
"received unexpected output\n%s", err)
}
// Tests Services
for _, svc := range services {
if err := h.CheckService(ctx, svc.Namespace, svc.Name); err != nil {
AnnotatedErrorf(t, fmt.Sprintf("error validating service [%s/%s]", svc.Namespace, svc.Name),
"error validating service [%s/%s]:\n%s", svc.Namespace, svc.Name, err)
}
}
// Tests Pods and Deployments
for deploy, spec := range deploys {
if err := h.CheckPods(ctx, spec.Namespace, deploy, spec.Replicas); err != nil {
//nolint:errorlint
if rce, ok := err.(*RestartCountError); ok {
AnnotatedWarn(t, "CheckPods timed-out", rce)
} else {
AnnotatedFatal(t, "CheckPods timed-out", err)
}
}
}
}
// ExerciseTestAppEndpoint tests if the emojivoto service is reachable
func ExerciseTestAppEndpoint(endpoint, namespace string, h *TestHelper) error {
testAppURL, err := h.URLFor(context.Background(), namespace, "web", 8080)
if err != nil {
return err
}
for i := 0; i < 30; i++ {
_, err := h.HTTPGetURL(testAppURL + endpoint)
if err != nil {
return err
}
}
return nil
}