Skip to content

Commit

Permalink
Update tls_cert_create_test.go
Browse files Browse the repository at this point in the history
Update Test for the Warn text
  • Loading branch information
lhaig committed Nov 14, 2022
1 parent b3f308d commit c00c1e9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion command/tls_cert_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func TestTlsCertCreateCommand_fileCreate(t *testing.T) {
expectCN string
expectDNS []string
expectIP []net.IP
errOut string
}

// The following subtests must run serially.
Expand All @@ -88,6 +89,7 @@ func TestTlsCertCreateCommand_fileCreate(t *testing.T) {
"localhost",
},
[]net.IP{{127, 0, 0, 1}},
"==> WARNING: Server Certificates grants authority to become a\n server and access all state in the cluster including root keys\n and all ACL tokens. Do not distribute them to production hosts\n that are not server nodes. Store them as securely as CA keys.\n",
},
{"server0-region2-altdomain",
"server",
Expand All @@ -100,6 +102,7 @@ func TestTlsCertCreateCommand_fileCreate(t *testing.T) {
"localhost",
},
[]net.IP{{127, 0, 0, 1}},
"==> WARNING: Server Certificates grants authority to become a\n server and access all state in the cluster including root keys\n and all ACL tokens. Do not distribute them to production hosts\n that are not server nodes. Store them as securely as CA keys.\n",
},
{"client0",
"client",
Expand All @@ -112,6 +115,7 @@ func TestTlsCertCreateCommand_fileCreate(t *testing.T) {
"localhost",
},
[]net.IP{{127, 0, 0, 1}},
"",
},
{"client0-region2-altdomain",
"client",
Expand All @@ -124,6 +128,7 @@ func TestTlsCertCreateCommand_fileCreate(t *testing.T) {
"localhost",
},
[]net.IP{{127, 0, 0, 1}},
"",
},
{"cli0",
"cli",
Expand All @@ -136,6 +141,7 @@ func TestTlsCertCreateCommand_fileCreate(t *testing.T) {
"localhost",
},
nil,
"",
},
{"cli0-region2-altdomain",
"cli",
Expand All @@ -148,6 +154,7 @@ func TestTlsCertCreateCommand_fileCreate(t *testing.T) {
"localhost",
},
nil,
"",
},
}

Expand All @@ -157,7 +164,7 @@ func TestTlsCertCreateCommand_fileCreate(t *testing.T) {
ui := cli.NewMockUi()
cmd := &TLSCertCreateCommand{Meta: Meta{Ui: ui}}
require.Equal(t, 0, cmd.Run(tc.args))
require.Equal(t, "", ui.ErrorWriter.String())
require.Equal(t, tc.errOut, ui.ErrorWriter.String())

// is a valid cert expects the cert
cert := testutil.IsValidCertificate(t, tc.certPath)
Expand Down

0 comments on commit c00c1e9

Please sign in to comment.