Skip to content

Add tests to increase new code coverage to 80%

52c8042
Select commit
Loading
Failed to load commit list.
Open

[CLI-2354] Add confluent organization use command for org switching #3277

Add tests to increase new code coverage to 80%
52c8042
Select commit
Loading
Failed to load commit list.
SonarQube-Confluent / SonarQube Code Analysis succeeded Mar 15, 2026 in 38s

Annotations

Check warning on line 146 in pkg/config/context_test.go

See this annotation in the file changed.

@sonarqube-confluent sonarqube-confluent / SonarQube Code Analysis

Rename function "TestSwitchOrganization_RollbackOnFailure" to match the regular expression ^(_|[a-zA-Z0-9]+)$

[S100] Function names should comply with a naming convention
 See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3277&issues=17df5a75-f97a-4b7d-ba82-f4fc2db6320f&open=17df5a75-f97a-4b7d-ba82-f4fc2db6320f

Check failure on line 121 in pkg/config/context_test.go

See this annotation in the file changed.

@sonarqube-confluent sonarqube-confluent / SonarQube Code Analysis

Define a constant instead of duplicating this literal "env-123" 7 times.

[S1192] String literals should not be duplicated
 See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3277&issues=180e1319-044e-4a78-9ca8-beabc8edbdd1&open=180e1319-044e-4a78-9ca8-beabc8edbdd1

Check warning on line 115 in pkg/config/context_test.go

See this annotation in the file changed.

@sonarqube-confluent sonarqube-confluent / SonarQube Code Analysis

Rename function "TestSwitchOrganization_ClearsEnvironmentState" to match the regular expression ^(_|[a-zA-Z0-9]+)$

[S100] Function names should comply with a naming convention
 See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3277&issues=f736780c-f534-4310-a5d6-42bc00fb99b7&open=f736780c-f534-4310-a5d6-42bc00fb99b7

Check failure on line 124 in pkg/config/context_test.go

See this annotation in the file changed.

@sonarqube-confluent sonarqube-confluent / SonarQube Code Analysis

Define a constant instead of duplicating this literal "lkc-999" 3 times.

[S1192] String literals should not be duplicated
 See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3277&issues=51095a1e-1836-4ff3-91a4-e5f7dfdad2af&open=51095a1e-1836-4ff3-91a4-e5f7dfdad2af

Check warning on line 32 in internal/organization/command_use.go

See this annotation in the file changed.

@sonarqube-confluent sonarqube-confluent / SonarQube Code Analysis

Remove this unnecessary variable declaration and use the expression directly in the condition.

[S8193] Variables in if short statements should be used beyond just the condition
 See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3277&issues=cddbc1fb-3db8-4f9c-a266-1c513744e030&open=cddbc1fb-3db8-4f9c-a266-1c513744e030

Check failure on line 135 in pkg/config/context_test.go

See this annotation in the file changed.

@sonarqube-confluent sonarqube-confluent / SonarQube Code Analysis

Define a constant instead of duplicating this literal "org-other" 4 times.

[S1192] String literals should not be duplicated
 See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3277&issues=699ad6c1-b6ad-44ef-b45e-6eef8841f869&open=699ad6c1-b6ad-44ef-b45e-6eef8841f869

Check warning on line 180 in pkg/config/context_test.go

See this annotation in the file changed.

@sonarqube-confluent sonarqube-confluent / SonarQube Code Analysis

Rename function "TestSwitchOrganization_NilKafkaClusterContext" to match the regular expression ^(_|[a-zA-Z0-9]+)$

[S100] Function names should comply with a naming convention
 See more on https://sonarqube.confluent.io/project/issues?id=cli&pullRequest=3277&issues=d4c412d0-3258-463e-8ee4-0484f339ea32&open=d4c412d0-3258-463e-8ee4-0484f339ea32