...
1 package rsaca
2
3 import (
4 "context"
5 "fmt"
6 "os"
7 "testing"
8
9 "github.com/linkerd/linkerd2/testutil"
10 )
11
12
13
14
15
16 var (
17 TestHelper *testutil.TestHelper
18 )
19
20 func TestMain(m *testing.M) {
21 TestHelper = testutil.NewTestHelper()
22 os.Exit(m.Run())
23 }
24
25
26
27
28
29 func TestRsaCa(t *testing.T) {
30 err := TestHelper.CreateControlPlaneNamespaceIfNotExists(context.Background(), TestHelper.GetLinkerdNamespace())
31 if err != nil {
32 testutil.AnnotatedFatalf(t, fmt.Sprintf("failed to create %s namespace", TestHelper.GetLinkerdNamespace()),
33 "failed to create %s namespace: %s", TestHelper.GetLinkerdNamespace(), err)
34 }
35
36
37 cmd := []string{
38 "install",
39 "--crds",
40 "--controller-log-level", "debug",
41 "--set", fmt.Sprintf("proxy.image.version=%s", TestHelper.GetVersion()),
42 "--set", "heartbeatSchedule=1 2 3 4 5",
43 }
44
45
46 out, err := TestHelper.LinkerdRun(cmd...)
47 if err != nil {
48 testutil.AnnotatedFatal(t, "'linkerd install --crds' command failed", err)
49 }
50
51 out, err = TestHelper.KubectlApplyWithArgs(out)
52 if err != nil {
53 testutil.AnnotatedFatalf(t, "'kubectl apply' command failed",
54 "'kubectl apply' command failed\n%s", out)
55 }
56
57
58 cmd = []string{
59 "install",
60 "--controller-log-level", "debug",
61 "--set", fmt.Sprintf("proxy.image.version=%s", TestHelper.GetVersion()),
62 "--identity-trust-anchors-file", "testdata/ca.crt",
63 "--identity-issuer-certificate-file", "testdata/issuer.crt",
64 "--identity-issuer-key-file", "testdata/issuer.key",
65 }
66
67
68 out, err = TestHelper.LinkerdRun(cmd...)
69 if err != nil {
70 testutil.AnnotatedFatal(t, "'linkerd install' command failed", err)
71 }
72
73 out, err = TestHelper.KubectlApplyWithArgs(out)
74 if err != nil {
75 testutil.AnnotatedFatalf(t, "'kubectl apply' command failed",
76 "'kubectl apply' command failed\n%s", out)
77 }
78
79 TestHelper.WaitRollout(t, testutil.LinkerdDeployReplicasEdge)
80 }
81
View as plain text