Skip to content

Commit 4882a3d

Browse files
committed
Add integration test
1 parent b35f2e2 commit 4882a3d

File tree

8 files changed

+17
-5
lines changed

8 files changed

+17
-5
lines changed

internal/api-key/command.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ func (c *command) addResourceFlag(cmd *cobra.Command, isStore bool) {
108108
i++
109109
}
110110

111-
// TODO: update the suggestions when the suggestions[i] related with Tableflow is ready
112111
if !isStore {
113112
suggestions = append(suggestions, "cloud")
114113
suggestions = append(suggestions, "global")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
confluent.controlcenter.alertmanager.config.file=abc
2+
confluent.controlcenter.prometheus.rules.file=def

test/api_key_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ func (s *CLITestSuite) TestApiKeyCreate() {
160160
tests := []CLITest{
161161
{args: "api-key create --resource flink --cloud aws --region us-east-1", fixture: "api-key/create-flink.golden"},
162162
{args: "api-key create --resource lkc-ab123 --service-account sa-123456", fixture: "api-key/55.golden", exitCode: 1},
163+
{args: "api-key create --description human-output --resource global", fixture: "api-key/create-global.golden"},
163164
}
164165

165166
for _, test := range tests {
@@ -186,8 +187,8 @@ func (s *CLITestSuite) TestApiKeyDescribe() {
186187
func (s *CLITestSuite) TestApiKeyDelete() {
187188
tests := []CLITest{
188189
// delete multiple API keys
189-
{args: "api-key delete MYKEY7 MYKEY8 MYKEY19", fixture: "api-key/delete/multiple-fail.golden", exitCode: 1},
190-
{args: "api-key delete MYKEY6 MYKEY18 MYKEY19", fixture: "api-key/delete/multiple-fail-plural.golden", exitCode: 1},
190+
{args: "api-key delete MYKEY7 MYKEY8 MYKEY20", fixture: "api-key/delete/multiple-fail.golden", exitCode: 1},
191+
{args: "api-key delete MYKEY6 MYKEY18 MYKEY20", fixture: "api-key/delete/multiple-fail-plural.golden", exitCode: 1},
191192
{args: "api-key delete MYKEY7 MYKEY8", input: "n\n", fixture: "api-key/delete/multiple-refuse.golden"},
192193
{args: "api-key delete MYKEY7 MYKEY8", input: "y\n", fixture: "api-key/delete/multiple-success.golden"},
193194
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
It may take a couple of minutes for the API key to be ready.
2+
Save the API key and secret. The secret is not retrievable later.
3+
+------------+------------+
4+
| API Key | MYKEY19 |
5+
| API Secret | MYSECRET19 |
6+
+------------+------------+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Error: API key "MYKEY19" not found
1+
Error: API key "MYKEY20" not found
22

33
Suggestions:
44
List available API keys with `confluent api-key list`.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Error: API key "MYKEY19" not found
1+
Error: API key "MYKEY20" not found
22

33
Suggestions:
44
List available API keys with `confluent api-key list`.

test/fixtures/output/api-key/describe-autocomplete.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ MYKEY15 yaml-output
1212
MYKEY16 my-cool-app
1313
MYKEY17
1414
MYKEY18
15+
MYKEY19 human-output
1516
MYKEY2
1617
MYKEY3
1718
MYKEY4 my-cool-app

test/test-server/iam_handlers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ func getKind(id string) string {
176176
if id == "cloud" {
177177
return "Cloud"
178178
}
179+
if id == "global" {
180+
return "Global"
181+
}
179182
if id == "tableflow" {
180183
return "Tableflow"
181184
}

0 commit comments

Comments
 (0)