From 34a1591a90447cf766c7eeef9f2b21f1353cd84a Mon Sep 17 00:00:00 2001 From: James Rasell Date: Wed, 24 Aug 2022 15:14:49 +0100 Subject: [PATCH] cli: output none when a token has no expiration. --- command/acl_bootstrap.go | 2 +- command/acl_bootstrap_test.go | 4 ++-- command/acl_token_create_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/command/acl_bootstrap.go b/command/acl_bootstrap.go index a1844365c..b1d07968b 100644 --- a/command/acl_bootstrap.go +++ b/command/acl_bootstrap.go @@ -198,7 +198,7 @@ func outputACLToken(ui cli.Ui, token *api.ACLToken) { func expiryTimeString(t *time.Time) string { if t == nil || t.IsZero() { - return "" + return "" } return t.String() } diff --git a/command/acl_bootstrap_test.go b/command/acl_bootstrap_test.go index 96f489e02..58c247956 100644 --- a/command/acl_bootstrap_test.go +++ b/command/acl_bootstrap_test.go @@ -36,7 +36,7 @@ func TestACLBootstrapCommand(t *testing.T) { out := ui.OutputWriter.String() assert.Contains(out, "Secret ID") - require.Contains(t, out, "Expiry Time = ") + require.Contains(t, out, "Expiry Time = ") } // If a bootstrap token has already been created, attempts to create more should @@ -117,7 +117,7 @@ func TestACLBootstrapCommand_WithOperatorFileBootstrapToken(t *testing.T) { out := ui.OutputWriter.String() assert.Contains(t, out, mockToken.SecretID) - require.Contains(t, out, "Expiry Time = ") + require.Contains(t, out, "Expiry Time = ") } // Attempting to bootstrap the server with an invalid operator provided token in a file should diff --git a/command/acl_token_create_test.go b/command/acl_token_create_test.go index b2d7c08cb..b6b4223da 100644 --- a/command/acl_token_create_test.go +++ b/command/acl_token_create_test.go @@ -39,7 +39,7 @@ func TestACLTokenCreateCommand(t *testing.T) { // Check the output out := ui.OutputWriter.String() require.Contains(t, out, "[foo]") - require.Contains(t, out, "Expiry Time = ") + require.Contains(t, out, "Expiry Time = ") ui.OutputWriter.Reset() ui.ErrorWriter.Reset() @@ -49,7 +49,7 @@ func TestACLTokenCreateCommand(t *testing.T) { require.Equal(t, 0, code) out = ui.OutputWriter.String() - require.NotContains(t, out, "Expiry Time = ") + require.NotContains(t, out, "Expiry Time = ") } func Test_generateACLTokenRoleLinks(t *testing.T) {