-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
82 lines (81 loc) · 2.37 KB
/
doc.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
73
74
75
76
77
78
79
80
81
82
// package clustertest provides the main entry point to the framework for E2E cluster testing.
//
// The [Framework] is configured around a Management Cluster that is used for the creation of test workload clusters.
//
// # Example
//
// ctx := context.Background()
//
// framework, err := clustertest.New("context_name")
// if err != nil {
// panic(err)
// }
//
// cluster := application.NewClusterApp(utils.GenerateRandomName("t"), application.ProviderAWS).
// WithOrg(organization.NewRandomOrg()).
// WithAppVersions("", ""). // If not set, the latest is fetched
// WithAppValuesFile(path.Clean("./test_data/cluster_values.yaml"), path.Clean("./test_data/default-apps_values.yaml"))
//
// client, err := framework.ApplyCluster(ctx, cluster)
//
// // Run tests...
//
// err = framework.DeleteCluster(ctx, cluster)
// # Example using an existing Workload Cluster
//
// ctx := context.Background()
//
// framework, err := clustertest.New("context_name")
// if err != nil {
// panic(err)
// }
//
// // The E2E_WC_NAME and E2E_WC_NAMESPACE env vars must be exported
// cluster, err := framework.LoadCluster()
// if err != nil {
// panic(err)
// }
// if cluster == nil {
// // Handle the case where the env vars aren't provided
// }
//
// // Run tests...
// // No need to clean up as the user is responsible for the cluster
//
// # Example Using Ginkgo
//
// func TestCAPA(t *testing.T) {
// var err error
// ctx := context.Background()
//
// framework, err = clustertest.New("context_name")
// if err != nil {
// panic(err)
// }
// logger.LogWriter = GinkgoWriter
//
// cluster = application.NewClusterApp(utils.GenerateRandomName("t"), application.ProviderAWS).
// WithOrg(organization.NewRandomOrg()).
// WithAppVersions("", ""). // If not set, the latest is fetched
// WithAppValuesFile(path.Clean("./test_data/cluster_values.yaml"), path.Clean("./test_data/default-apps_values.yaml"))
//
// BeforeSuite(func() {
// client, err := framework.ApplyCluster(ctx, cluster)
// Expect(err).To(BeNil())
//
// Eventually(
// wait.AreNumNodesReady(ctx, client, 3, &cr.MatchingLabels{"node-role.kubernetes.io/control-plane": ""}),
// 20*time.Minute,
// 30*time.Second,
// ).Should(BeTrue())
// })
//
// AfterSuite(func() {
// err := framework.DeleteCluster(ctx, cluster)
// Expect(err).To(BeNil())
// })
//
// RegisterFailHandler(Fail)
// RunSpecs(t, "CAPA Suite")
// }
package clustertest