updating test

This commit is contained in:
Dhawal Seth 2026-01-28 22:25:38 -08:00
parent e9bdb88186
commit ffb56ac50b
1 changed files with 11 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package actions_test
import (
"context"
"errors"
"net/http"
"testing"
"time"
@ -77,12 +78,18 @@ func TestGenerateJitRunnerConfig(t *testing.T) {
_, err = client.GenerateJitRunnerConfig(ctx, runnerSettings, 1)
require.NotNil(t, err)
// Verify error message includes HTTP method and URL for better debugging
assert.Contains(t, err.Error(), "POST")
assert.Contains(t, err.Error(), "generatejitconfig")
// The status code will be included through ParseActionsErrorFromResponse
errMsg := err.Error()
assert.Contains(t, errMsg, "POST", "Error message should include HTTP method")
assert.Contains(t, errMsg, "generatejitconfig", "Error message should include URL path")
// The error might be an ActionsError (if response was received) or a wrapped error (if Do() failed)
// In either case, the error message should include request details
var actionsErr *actions.ActionsError
if assert.ErrorAs(t, err, &actionsErr) {
if errors.As(err, &actionsErr) {
// If we got an ActionsError, verify the status code is included
assert.Equal(t, http.StatusInternalServerError, actionsErr.StatusCode)
}
// If it's a wrapped error from Do(), the error message already includes the method and URL
// which is what we're testing for
})
}