Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(database): add integration testing #896

Merged
merged 98 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
74626c9
Merge branch 'main' of github.com:go-vela/server
jbrockopp Feb 14, 2023
974c8e6
Merge branch 'main' of github.com:go-vela/server
jbrockopp Mar 3, 2023
2f2c425
Merge branch 'main' of github.com:go-vela/server
jbrockopp Mar 20, 2023
528291a
Merge branch 'main' of github.com:go-vela/server
jbrockopp Apr 8, 2023
b53c687
Merge branch 'main' of github.com:go-vela/server
jbrockopp Apr 8, 2023
4734dcb
Merge branch 'main' of github.com:go-vela/server
jbrockopp Apr 16, 2023
1fb52df
Merge branch 'main' of github.com:go-vela/server
jbrockopp Apr 21, 2023
e996aa6
Merge branch 'main' of github.com:go-vela/server
jbrockopp Apr 27, 2023
c299ee4
Merge branch 'main' of github.com:go-vela/server
jbrockopp May 11, 2023
c8da9e3
Merge branch 'main' of github.com:go-vela/server
jbrockopp May 16, 2023
1ee254f
Merge branch 'main' of github.com:go-vela/server
jbrockopp May 22, 2023
8dd6033
Merge branch 'main' of github.com:go-vela/server
jbrockopp May 22, 2023
0eb92b1
Merge branch 'main' of github.com:go-vela/server
jbrockopp May 26, 2023
d5dcb6d
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 1, 2023
be8dd9a
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 5, 2023
73893b5
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 7, 2023
355017b
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 8, 2023
3e17278
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 8, 2023
d3c1e06
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 12, 2023
d63abfe
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 17, 2023
a353552
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 21, 2023
f1a8ab6
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 26, 2023
c23c599
Merge branch 'main' of github.com:go-vela/server
jbrockopp Jun 28, 2023
683248d
feat(database): add integration testing
jbrockopp Jun 28, 2023
e2f9307
feat(actions): add integration-test workflow
jbrockopp Jun 28, 2023
b910bfc
feat(database): add integration tests
jbrockopp Jun 28, 2023
09fd217
fix: use env var to skip integration tests
jbrockopp Jun 28, 2023
643f27a
fix: password for integration tests
jbrockopp Jun 28, 2023
ffca1a2
test: comment out paths for prs
jbrockopp Jun 28, 2023
4f57c94
revert: comment out paths for prs
jbrockopp Jun 28, 2023
7bfb032
enhance(database): add worker integration tests
jbrockopp Jun 28, 2023
aa52426
fix(database): timestamps for worker tests
jbrockopp Jun 28, 2023
23a9c59
chore: save work
jbrockopp Jun 28, 2023
1dcb17b
enhance(database): add method counter
jbrockopp Jun 28, 2023
77eb03e
fix(database): subtract 2 from methods
jbrockopp Jun 28, 2023
ad25372
enhance(database): add user integration tests
jbrockopp Jun 29, 2023
b218eea
chore: address review feedback
jbrockopp Jun 29, 2023
d99f960
fix(database): names for users
jbrockopp Jun 29, 2023
4a0601a
enhance(database): add step integration tests
jbrockopp Jun 29, 2023
541d2e3
fix: typo
jbrockopp Jun 29, 2023
43cc062
test: output diff
jbrockopp Jun 29, 2023
cd8f56e
chore: minor fixes
jbrockopp Jun 29, 2023
111916c
fix(database): users
jbrockopp Jun 29, 2023
a6d0dcc
fix(database): steps
jbrockopp Jun 29, 2023
c1f92cc
fix: typo
jbrockopp Jun 29, 2023
3a4ef4d
fix(database): steps
jbrockopp Jun 29, 2023
6384b5e
feat(database): add services
jbrockopp Jun 29, 2023
c34dcb3
feat(database): add builds
jbrockopp Jun 29, 2023
d6912ca
fix(database): users
jbrockopp Jun 29, 2023
18a68fe
fix(database): integration tests
jbrockopp Jun 29, 2023
63d6b19
feat(database): add hooks
jbrockopp Jun 29, 2023
eddc018
feat(database): add logs
jbrockopp Jun 29, 2023
39ed3ff
feat(database): add pipelines
jbrockopp Jun 29, 2023
d40a96d
feat(database): add repos
jbrockopp Jun 29, 2023
29881ac
feat(database): add schedules
jbrockopp Jun 29, 2023
263b1df
feat(database): add secrets
jbrockopp Jun 29, 2023
ada878b
Merge branch 'main' into hackathon/integration
jbrockopp Jun 29, 2023
69cf142
Merge branch 'hackathon/integration' of github.com:go-vela/server int…
jbrockopp Jun 29, 2023
d1a6232
fix(database): integration tests
jbrockopp Jun 29, 2023
f50a30d
fix(database): integration tests
jbrockopp Jun 29, 2023
e9766d4
fix(database: fix logs
jbrockopp Jun 29, 2023
0603090
fix(database: fix pipelines
jbrockopp Jun 29, 2023
32b076d
fix(database): repos
jbrockopp Jun 29, 2023
8735c04
fix(database): integration tests
jbrockopp Jun 29, 2023
94f66eb
fix(database): integration tests
jbrockopp Jun 29, 2023
dd27785
fix(database): minus one
jbrockopp Jun 29, 2023
e0e82b1
chore: cleanup
jbrockopp Jun 30, 2023
b4f16a2
chore: misc fixes
jbrockopp Jun 30, 2023
3f841bc
fix(database): user integration test
jbrockopp Jun 30, 2023
a02f2fd
fix(database): build integration tests
jbrockopp Jun 30, 2023
b432a66
fix(database): build integration tests
jbrockopp Jun 30, 2023
db6e2f0
fix(database): integration tests
jbrockopp Jun 30, 2023
ac0d699
fix(database): secrets integration tests
jbrockopp Jun 30, 2023
ad9c574
fix(database): integration tests
jbrockopp Jun 30, 2023
5a56952
fix(database): integration tests
jbrockopp Jun 30, 2023
f42085f
fix(database): secrets integration tests
jbrockopp Jul 3, 2023
ea00645
test: troubleshoot build failures
jbrockopp Jul 3, 2023
aaea5aa
fix(database): integration tests
jbrockopp Jul 3, 2023
88e0d5c
fix(database): integration tests
jbrockopp Jul 3, 2023
e168b62
fix(database): integration tests
jbrockopp Jul 3, 2023
c226c03
feat(database): add sqlite integration tests
jbrockopp Jul 3, 2023
78c8ac4
fix(database): sqlite integration tests
jbrockopp Jul 3, 2023
2f3f7fe
Merge branch 'main' into hackathon/integration
jbrockopp Jul 10, 2023
836279c
Merge branch 'main' into hackathon/integration
jbrockopp Jul 11, 2023
9a644d8
Merge branch 'hackathon/integration' of github.com:go-vela/server int…
jbrockopp Jul 11, 2023
95ed34b
fix(database/hook): unique constraints for CreateSqliteTable
jbrockopp Jul 11, 2023
387eed0
fix(database/logs): consistency between drivers
jbrockopp Jul 11, 2023
33b20e7
Merge branch 'main' into hackathon/integration
jbrockopp Jul 24, 2023
f6a16de
Merge branch 'main' into hackathon/integration
jbrockopp Jul 25, 2023
8581d6d
Merge branch 'hackathon/integration' of github.com:go-vela/server int…
jbrockopp Jul 25, 2023
ea17b66
fix: issues from merge
jbrockopp Jul 25, 2023
3ed7f45
chore: add missing comment
jbrockopp Jul 25, 2023
95b534d
Merge branch 'main' into hackathon/integration
jbrockopp Jul 25, 2023
8e3a77d
Merge branch 'main' into hackathon/integration
jbrockopp Jul 27, 2023
09fa268
Merge branch 'hackathon/integration' of github.com:go-vela/server int…
jbrockopp Jul 28, 2023
221cb08
chore: address review feedback
jbrockopp Jul 28, 2023
6b67568
chore: remove unneeded file
jbrockopp Jul 28, 2023
061ff80
chore: undo comments
jbrockopp Jul 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# name of the action
name: integration-test

# trigger on pull_request events that modify this file or any database files
on:
pull_request:
paths:
- '.github/workflows/integration-test.yml'
- 'database/**'

# pipeline to execute
jobs:
database:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_DB: vela
POSTGRES_PASSWORD: notARealPassword12345
POSTGRES_USER: vela
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

env:
POSTGRES_ADDR: postgres://vela:notARealPassword12345@localhost:5432/vela
SQLITE_ADDR: vela.db

steps:
- name: clone
uses: actions/checkout@v3

- name: install go
uses: actions/setup-go@v4
with:
# use version from go.mod file
go-version-file: 'go.mod'
cache: true
check-latest: true

- name: test
run: |
make integration-test
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:

- name: test
run: |
go test -race -covermode=atomic -coverprofile=coverage.out ./...
make test

- name: coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.out
file: coverage.out
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ fix:
@echo "### Fixing Go Code"
@go fix ./...

# The `integration-test` target is intended to run all integration tests for the Go source code.
.PHONY: integration-test
integration-test:
@echo
@echo "### Integration Testing"
INTEGRATION=1 go test -run TestDatabase_Integration ./...

# The `test` target is intended to run
# the tests for the Go source code.
#
Expand All @@ -99,18 +106,15 @@ fix:
test:
@echo
@echo "### Testing Go Code"
@go test -race ./...
@go test -race -covermode=atomic -coverprofile=coverage.out ./...

# The `test-cover` target is intended to run
# the tests for the Go source code and then
# open the test coverage report.
#
# Usage: `make test-cover`
.PHONY: test-cover
test-cover:
@echo
@echo "### Creating test coverage report"
@go test -race -covermode=atomic -coverprofile=coverage.out ./...
test-cover: test
@echo
@echo "### Opening test coverage report"
@go tool cover -html=coverage.out
Expand Down
2 changes: 1 addition & 1 deletion database/hook/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ hooks (
status TEXT,
link TEXT,
webhook_id INTEGER,
UNIQUE(repo_id, build_id)
UNIQUE(repo_id, number)
wass3rw3rk marked this conversation as resolved.
Show resolved Hide resolved
);
`
)
Expand Down
Loading
Loading