Skip to content

Commit 2e77407

Browse files
ReleaseHelperReleaseHelper
authored andcommitted
update test
1 parent 8215477 commit 2e77407

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tools/sdk-ai-bots/azure-sdk-qa-bot-backend/test/pipeline_analyzer_test.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,54 +58,51 @@ func TestExtractBuildID(t *testing.T) {
5858
tests := []struct {
5959
name string
6060
url string
61-
expectedID int
61+
expectedID string
6262
expectError bool
6363
}{
6464
{
6565
name: "Valid pipeline link with results",
6666
url: "https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5530426",
67-
expectedID: 5530426,
67+
expectedID: "5530426",
6868
expectError: false,
6969
},
7070
{
7171
name: "Valid pipeline link without results",
7272
url: "https://dev.azure.com/azure-sdk/public/_build?buildId=12345",
73-
expectedID: 12345,
73+
expectedID: "12345",
7474
expectError: false,
7575
},
7676
{
7777
name: "Invalid - no buildId parameter",
7878
url: "https://dev.azure.com/azure-sdk/internal/_build/results",
79-
expectedID: 0,
79+
expectedID: "0",
8080
expectError: true,
8181
},
8282
{
8383
name: "Invalid - not a pipeline link",
8484
url: "https://github.com/Azure/azure-sdk-tools",
85-
expectedID: 0,
85+
expectedID: "0",
8686
expectError: true,
8787
},
8888
{
8989
name: "Valid - URL with space in project name and query params",
9090
url: "https://dev.azure.com/azure-sdk/public/public Team/_build/results?buildId=5530426&view=logs",
91-
expectedID: 5530426,
91+
expectedID: "5530426",
9292
expectError: false,
9393
},
9494
}
9595

9696
for _, tt := range tests {
9797
t.Run(tt.name, func(t *testing.T) {
98-
buildID, err := utils.ExtractBuildID(tt.url)
98+
buildID := utils.ExtractBuildID(tt.url)
9999
if tt.expectError {
100-
if err == nil {
100+
if buildID != "" {
101101
t.Errorf("ExtractBuildID(%q) expected error but got none", tt.url)
102102
}
103103
} else {
104-
if err != nil {
105-
t.Errorf("ExtractBuildID(%q) unexpected error: %v", tt.url, err)
106-
}
107104
if buildID != tt.expectedID {
108-
t.Errorf("ExtractBuildID(%q) = %d, expected %d", tt.url, buildID, tt.expectedID)
105+
t.Errorf("ExtractBuildID(%q) = %s, expected %s", tt.url, buildID, tt.expectedID)
109106
}
110107
}
111108
})

0 commit comments

Comments
 (0)