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

chore: update workflow test file #38

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 14 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,20 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install Dependenies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends ca-certificates postgresql-client

- name: Checkout code
uses: actions/checkout@v3

- name: Add tables
run: PGPASSWORD=testPass psql -U testUser -h localhost -p 5432 -d testDB -c 'CREATE TABLE entries (id BIGSERIAL PRIMARY KEY, amount REAL, user_id VARCHAR(6), entry_date DATE, timestamp TIMESTAMP)';

- name: Build binary
run: CGO_ENABLED=0 go build -o server.bin -ldflags="-s -w -X 'main.buildString=${BUILDSTR}'" ./cmd/*.go

- name: Run binary server
run: ./server.bin --config config.test.toml &

- name: Run tests
run: go test ./cmd -v -covermode=count
run: sleep 5 && go test ./client -v -covermode=count
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ Often times, different queries have different priorities of execution. Some may
```shell
# Run the primary worker + HTTP control interface
dungbeetle --config /path/to/config.toml --sql-directory /path/to/sql/dir \
--queue "high_priority" \
--queue "high_priority" \
--worker-name "high_priority_worker" \
--worker-concurrency 30

# Run another worker on a different queue to handle low priority jobs
dungbeetle --config /path/to/config.toml --sql-directory /path/to/sql/dir \
--queue "low_priority" \
--queue "low_priority" \
--worker-name "low_priority_worker" \
--worker-concurrency 5 \
--worker-only
Expand Down
44 changes: 44 additions & 0 deletions config.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[app]
log_level = "DEBUG"
default_job_ttl = "60s"

[job_queue.broker]
type = "redis"
addresses = ["localhost:6379"]
password = ""
db = 1
max_active = 50
max_idle = 20
dial_timeout = "1s"
read_timeout = "1s"
write_timeout = "1s"

[job_queue.state]
type = "redis"
addresses = ["localhost:6379"]
password = ""
db = 1
max_active = 50
max_idle = 20
dial_timeout = "1s"
read_timeout = "1s"
write_timeout = "1s"
expiry = "30s"
meta_expiry = "3600s"

[results.my_results]
type = "postgres"
dsn = "postgres://testUser:testPass@localhost:5432/testDB?sslmode=disable"

max_idle = 10
max_active = 100
connect_timeout = "10s"

results_table = "results_%s"

[db.my_db]
type = "postgres"
dsn = "postgres://testUser:testPass@127.0.0.1:5432/testDB?sslmode=disable"
max_idle = 10
max_active = 100
connect_timeout = "10s"