-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration_test.go
72 lines (64 loc) · 1.36 KB
/
integration_test.go
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"os/exec"
"testing"
)
func TestFullInstallationFlow(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
// This is a full system test - use with caution
tests := []struct {
name string
command string
args []string
wantErr bool
}{
{
name: "Full Installation Process",
command: "./bin/shapeblock-installer",
args: []string{"install"},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cmd := exec.Command(tt.command, tt.args...)
err := cmd.Run()
if (err != nil) != tt.wantErr {
t.Errorf("Installation failed: %v", err)
}
// Verify installation
if err := verifyInstallation(t); err != nil {
t.Errorf("Installation verification failed: %v", err)
}
})
}
}
func verifyInstallation(t *testing.T) error {
// Add verification steps
checks := []struct {
name string
command string
args []string
}{
{
name: "Check Kubernetes Cluster",
command: "kubectl",
args: []string{"get", "nodes"},
},
{
name: "Check Required Namespaces",
command: "kubectl",
args: []string{"get", "ns"},
},
// Add more verification checks
}
for _, check := range checks {
cmd := exec.Command(check.command, check.args...)
if err := cmd.Run(); err != nil {
return err
}
}
return nil
}