mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-27 17:28:52 +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 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
|
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 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
|
export HISHTORY_SERVER=http://localhost
|
||||||
go build
|
go build
|
||||||
./hishtory install
|
./hishtory install
|
||||||
@ -48,8 +48,12 @@ jobs:
|
|||||||
! (./hishtory export | grep "ls -Slah /")
|
! (./hishtory export | grep "ls -Slah /")
|
||||||
# Assert that the entry is syncing properly
|
# Assert that the entry is syncing properly
|
||||||
./hishtory status -v | grep 'Sync Status: Synced'
|
./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
|
# - name: Setup tmate session
|
||||||
# if: ${{ failure() }}
|
# # if: ${{ failure() }}
|
||||||
# uses: mxschmitt/action-tmate@v3
|
# uses: mxschmitt/action-tmate@v3
|
||||||
# with:
|
# with:
|
||||||
# limit-access-to-actor: true
|
# limit-access-to-actor: true
|
@ -41,6 +41,7 @@ services:
|
|||||||
delay: 3s
|
delay: 3s
|
||||||
environment:
|
environment:
|
||||||
HISHTORY_POSTGRES_DB: postgresql://postgres:TODO_YOUR_POSTGRES_PASSWORD_HERE@postgres:5432/hishtory?sslmode=disable
|
HISHTORY_POSTGRES_DB: postgresql://postgres:TODO_YOUR_POSTGRES_PASSWORD_HERE@postgres:5432/hishtory?sslmode=disable
|
||||||
|
HISHTORY_COMPOSE_TEST: $HISHTORY_COMPOSE_TEST
|
||||||
ports:
|
ports:
|
||||||
- 80:8080
|
- 80:8080
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -97,7 +97,19 @@ func OpenDB() (*database.DB, error) {
|
|||||||
}
|
}
|
||||||
err = db.CreateIndices()
|
err = db.CreateIndices()
|
||||||
if err != nil {
|
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
|
return db, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user