Skip to content

Commit

Permalink
Fixing unit tests and adding the unit test workflow
Browse files Browse the repository at this point in the history
Signed-off-by: ytimocin <ytimocin@microsoft.com>
  • Loading branch information
ytimocin committed Jan 4, 2025
1 parent 3aacb13 commit bffa36f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run Unit Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: Install dependencies
run: go mod tidy

- name: Run tests
run: go test -v ./...
3 changes: 2 additions & 1 deletion common/cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func TestNewCloudConnection(t *testing.T) {
want: Connection{
Name: "test",
Type: CloudConnectionType{
Subtype: "aws",
MainType: ConnectionTypeCloud,
Subtype: "AWS",
},
Details: CloudConnectionDetails{},
},
Expand Down
3 changes: 2 additions & 1 deletion common/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ func TestNewDatabaseConnection(t *testing.T) {
want: Connection{
Name: "test",
Type: DatabaseConnectionType{
Subtype: "postgres",
MainType: ConnectionTypeDatabase,
Subtype: "PostgreSQL",
},
Details: DatabaseConnectionDetails{
ConnectionString: "host=localhost user=test password=test dbname=test",
Expand Down
4 changes: 3 additions & 1 deletion common/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ func TestNewKubernetesConnection(t *testing.T) {
},
want: Connection{
Name: "test",
Type: KubernetesConnectionType{},
Type: KubernetesConnectionType{
MainType: ConnectionTypeKubernetes,
},
Details: KubernetesConnectionDetails{
SelectedContext: "test-context",
},
Expand Down

0 comments on commit bffa36f

Please sign in to comment.