Skip to content

Commit

Permalink
chore: add github CI
Browse files Browse the repository at this point in the history
adding github CI to ensure that test pass. fix one missed test as well.
  • Loading branch information
toumorokoshi authored Nov 1, 2024
1 parent 6df0ee5 commit c50f4be
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Go Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21" # Specify your Go version here

- name: Install dependencies
run: go mod download

- name: Run tests
run: go test -v ./...
5 changes: 3 additions & 2 deletions internal/service/service_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package service

import (
"strings"
"testing"
)

Expand Down Expand Up @@ -38,8 +39,8 @@ func TestService_ExecuteCommand_ListResources(t *testing.T) {
if err != nil {
t.Errorf("ExecuteCommand() error = %v, expected no error", err)
}
if result != tt.expected {
t.Errorf("ExecuteCommand() = %v, expected %v", result, tt.expected)
if !strings.Contains(result, tt.expected) {
t.Errorf("ExecuteCommand() = %v, expected it to contain %v", result, tt.expected)
}
})
}
Expand Down

0 comments on commit c50f4be

Please sign in to comment.