Skip to content

Commit c50f4be

Browse files
authored
chore: add github CI
adding github CI to ensure that test pass. fix one missed test as well.
1 parent 6df0ee5 commit c50f4be

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

.github/workflows/go-test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Go Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Run Unit Tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: "1.21" # Specify your Go version here
21+
22+
- name: Install dependencies
23+
run: go mod download
24+
25+
- name: Run tests
26+
run: go test -v ./...

internal/service/service_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package service
22

33
import (
4+
"strings"
45
"testing"
56
)
67

@@ -38,8 +39,8 @@ func TestService_ExecuteCommand_ListResources(t *testing.T) {
3839
if err != nil {
3940
t.Errorf("ExecuteCommand() error = %v, expected no error", err)
4041
}
41-
if result != tt.expected {
42-
t.Errorf("ExecuteCommand() = %v, expected %v", result, tt.expected)
42+
if !strings.Contains(result, tt.expected) {
43+
t.Errorf("ExecuteCommand() = %v, expected it to contain %v", result, tt.expected)
4344
}
4445
})
4546
}

0 commit comments

Comments
 (0)