Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
re-organized tests suite so it's more stable in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dstpierre committed May 20, 2024
1 parent e081523 commit 3c906e9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.22

- name: Setup .env file (PostgreSQL)
run: mv .gh-actions-env .env
Expand All @@ -31,7 +31,7 @@ jobs:
run: make build

- name: Test (PostgreSQL data store)
run: make alltest
run: make test-core

- name: Change DATA_STORE to Mongo
run: sed -i 's/DATA_STORE=pg/DATA_STORE=mongo/g' .env
Expand All @@ -46,4 +46,10 @@ jobs:
run: docker exec core_redis_1 redis-cli FLUSHDB

- name: Test (Mongo data store)
run: make alltest
run: make test-core

- name: Test all DBs implementation
run: make test-dbs

- name: Test all other components
run: make test-components
25 changes: 18 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ build:
start: build
@./cmd/staticbackend

deploy: build
scp cmd/staticbackend sb-poc:/home/dstpierre/sb
scp -qr ./templates/* sb-poc:/home/dstpierre/templates/
scp -qr ./sql/* sb-poc:/home/dstpierre/sql/

alltest:
@go clean -testcache && go test --cover ./...

Expand All @@ -43,15 +38,31 @@ test-mem:
test-sqlite:
@cd database/sqlite && go test --cover

test-dbs: test-pg test-mdb test-mem test-sqlite
@echo ""

test-backend:
@go test --cover ./backend/...

test-cache:
@go test --cover ./cache/...

test-storage:
@go test --cover ./storage/...

test-intl:
@JWT_SECRET=okdevmode go test --race --cover ./internal
@go test --cover ./internal

test-extra:
@JWT_SECRET=okdevmode go test --race --cover ./extra
@go test --cover ./extra

test-search:
@cd search && rm -rf testdata && go test --race --cover

test-components: test-backend test-cache test-storage test-intl test-extra test-search
@echo ""


stripe-dev:
stripe listen -p sb --forward-to http://localhost:8099/stripe

Expand Down
1 change: 0 additions & 1 deletion account.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ func (a *accounts) addDatabase(w http.ResponseWriter, r *http.Request) {
return
}

//TODO: When running tests, this fails and cannot retrieve the tenant
cust, err := backend.DB.FindTenant(conf.TenantID)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down
4 changes: 0 additions & 4 deletions account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ func TestUserAddRemoveFromAccount(t *testing.T) {
}

func TestAddNewDatabase(t *testing.T) {
t.Skip()

//TODO: This test should not fail

resp := dbReq(t, acct.addDatabase, "GET", "/account/add-db", nil)
defer resp.Body.Close()

Expand Down

0 comments on commit 3c906e9

Please sign in to comment.