diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 918bd43..0ea174b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 @@ -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 @@ -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 diff --git a/Makefile b/Makefile index 281ad77..f486fb3 100644 --- a/Makefile +++ b/Makefile @@ -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 ./... @@ -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 diff --git a/account.go b/account.go index d9c9b76..99d601d 100644 --- a/account.go +++ b/account.go @@ -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) diff --git a/account_test.go b/account_test.go index d9264d7..411ae78 100644 --- a/account_test.go +++ b/account_test.go @@ -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()