Skip to content

Commit

Permalink
remove unused contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOHart committed Oct 18, 2024
1 parent 1fc3c0f commit 325bfaf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions apps/managedidentity/managedidentity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,23 +545,20 @@ func Test_handleAzureArcResponse(t *testing.T) {
headers: map[string]string{},
expectedError: "managed identity error: 200",
platform: runtime.GOOS,
context: context.Background(),
},
{
name: "No www-authenticate header",
statusCode: http.StatusUnauthorized,
headers: map[string]string{},
expectedError: "response has no www-authenticate header",
platform: runtime.GOOS,
context: context.Background(),
},
{
name: "Basic realm= not found",
statusCode: http.StatusUnauthorized,
headers: map[string]string{wwwAuthenticateHeaderName: "Basic "},
expectedError: "basic realm= not found in the string, instead found: Basic ",
platform: runtime.GOOS,
context: context.Background(),
},
{
name: "Platform not supported",
Expand All @@ -578,7 +575,6 @@ func Test_handleAzureArcResponse(t *testing.T) {
expectedError: "invalid file extension, expected .key, got .txt",
platform: runtime.GOOS,
createMockFile: true,
context: context.Background(),
},
{
name: "Invalid file path",
Expand All @@ -587,7 +583,6 @@ func Test_handleAzureArcResponse(t *testing.T) {
expectedError: "invalid file path, expected /path/to/secret.key, got " + filepath.Join(testCaseFilePath, "secret.key"),
platform: runtime.GOOS,
createMockFile: true,
context: context.Background(),
},
{
name: "Unable to get file info",
Expand All @@ -596,7 +591,6 @@ func Test_handleAzureArcResponse(t *testing.T) {
expectedError: "unable to get file info for path " + filepath.Join(testCaseFilePath, "2secret.key"),
platform: runtime.GOOS,
createMockFile: true,
context: context.Background(),
},
{
name: "Invalid secret file size",
Expand All @@ -605,7 +599,6 @@ func Test_handleAzureArcResponse(t *testing.T) {
expectedError: "invalid secret file size, expected 4096, file size was 5000",
platform: runtime.GOOS,
createMockFile: true,
context: context.Background(),
},
{
name: "token request fail",
Expand Down Expand Up @@ -650,9 +643,12 @@ func Test_handleAzureArcResponse(t *testing.T) {
defer os.Remove(mockFilePath)
}

contextToUse := context.Background()
client := &Client{}

if tc.name == "token request fail" {
tc.context = nil
}

_, err := client.handleAzureArcResponse(tc.context, response, "", tc.platform)

if err == nil || err.Error() != tc.expectedError {
Expand Down

0 comments on commit 325bfaf

Please sign in to comment.