-
Notifications
You must be signed in to change notification settings - Fork 21
/
main_test.go
40 lines (32 loc) · 952 Bytes
/
main_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
//go:build e2e
// +build e2e
// Copyright (c) 2020 Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
package main
import (
"fmt"
"os"
"testing"
)
// TestRunMain wraps the main() function in order to build a test binary and collection coverage for
// E2E/Integration tests. Controller CLI flags are also passed in here.
func TestRunMain(t *testing.T) {
clusterNs := os.Getenv("E2E_CLUSTER_NAMESPACE")
if clusterNs == "" {
clusterNs = os.Getenv("MANAGED_CLUSTER_NAME")
}
clusterNsHub := os.Getenv("E2E_CLUSTER_NAMESPACE_ON_HUB")
if clusterNsHub == "" {
clusterNsHub = clusterNs
}
disableGkStr := os.Getenv("DISABLE_GK_SYNC")
disableGk := disableGkStr == "true"
os.Args = append(
os.Args,
"--leader-elect=false",
fmt.Sprintf("--disable-gatekeeper-sync=%t", disableGk),
fmt.Sprintf("--cluster-namespace=%s", clusterNs),
fmt.Sprintf("--cluster-namespace-on-hub=%s", clusterNsHub),
)
main()
}