mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-26 16:58:55 +01:00
* Add test coverage to prevent issues like #241 in the future * Add debugging * Fix location of HISHTORY_COMPOSE_TEST var * Enable tmate for failures * update * Re-comment tmate
This commit is contained in:
parent
a987801854
commit
11fc92ee5f
8
.github/workflows/docker-compose-test.yml
vendored
8
.github/workflows/docker-compose-test.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
sudo chmod 0755 -R /usr/share/zsh/ # Work around a weird bug where zsh on ubuntu actions gives that diretory 0777 which makes zsh refuse to start
|
||||
sudo hostname ghaction-runner-hostname # Set a consistent hostname so we can run tests that depend on it
|
||||
docker compose -f backend/server/docker-compose.yml build
|
||||
docker compose -f backend/server/docker-compose.yml up -d
|
||||
HISHTORY_COMPOSE_TEST=1 docker compose -f backend/server/docker-compose.yml up -d
|
||||
export HISHTORY_SERVER=http://localhost
|
||||
go build
|
||||
./hishtory install
|
||||
@ -48,8 +48,12 @@ jobs:
|
||||
! (./hishtory export | grep "ls -Slah /")
|
||||
# Assert that the entry is syncing properly
|
||||
./hishtory status -v | grep 'Sync Status: Synced'
|
||||
# And that we are properly using the self-hosted server
|
||||
./hishtory status -v | grep 'Sync Server: http://localhost'
|
||||
# Show the full status output for debugging
|
||||
./hishtory status -v
|
||||
# - name: Setup tmate session
|
||||
# if: ${{ failure() }}
|
||||
# # if: ${{ failure() }}
|
||||
# uses: mxschmitt/action-tmate@v3
|
||||
# with:
|
||||
# limit-access-to-actor: true
|
@ -41,6 +41,7 @@ services:
|
||||
delay: 3s
|
||||
environment:
|
||||
HISHTORY_POSTGRES_DB: postgresql://postgres:TODO_YOUR_POSTGRES_PASSWORD_HERE@postgres:5432/hishtory?sslmode=disable
|
||||
HISHTORY_COMPOSE_TEST: $HISHTORY_COMPOSE_TEST
|
||||
ports:
|
||||
- 80:8080
|
||||
volumes:
|
||||
|
@ -97,7 +97,19 @@ func OpenDB() (*database.DB, error) {
|
||||
}
|
||||
err = db.CreateIndices()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("failed to create indices: %w", err)
|
||||
}
|
||||
}
|
||||
if os.Getenv("HISHTORY_COMPOSE_TEST") != "" {
|
||||
// Run an extra round of migrations to test the migration code path to prevent issues like #241
|
||||
fmt.Println("AutoMigrating DB tables a second time for test coverage")
|
||||
err := db.AddDatabaseTables()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create underlying DB tables: %w", err)
|
||||
}
|
||||
err = db.CreateIndices()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create indices: %w", err)
|
||||
}
|
||||
}
|
||||
return db, nil
|
||||
|
Loading…
Reference in New Issue
Block a user