Skip to content

Commit

Permalink
test: use the right "docker compose" vs "docker-compose" for migratio…
Browse files Browse the repository at this point in the history
…ns in e2e tests
  • Loading branch information
ianroberts committed Nov 3, 2024
1 parent 9fc1509 commit 88ba89f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,18 @@ Cypress.Commands.add("logout", () => {

//Migrate integration db
Cypress.Commands.add("migrate_integration_db", (fixtureName) => {
if (Cypress.env('TESTENV') == 'container') {
cy.exec(`docker-compose exec -T backend ./migrate-integration.sh -n=${fixtureName}`)
} else if (Cypress.env('TESTENV') == 'ci') {
cy.exec(`DJANGO_SETTINGS_MODULE=teamware.settings.deployment docker-compose exec -T backend ./migrate-integration.sh -n=${fixtureName}`)

const testenv = Cypress.env('TESTENV');
if (testenv === 'container' || testenv === 'ci') {
// find the right docker compose command
cy.exec("docker compose").then(({code}) => {
const compose = (code === 0 ? 'docker compose' : 'docker-compose')
if (testenv === 'container') {
cy.exec(`${compose} exec -T backend ./migrate-integration.sh -n=${fixtureName}`)
} else if (testenv === 'ci') {
cy.exec(`DJANGO_SETTINGS_MODULE=teamware.settings.deployment ${compose} exec -T backend ./migrate-integration.sh -n=${fixtureName}`)
}
});
}
else{
cy.exec(`npm run migrate:integration -- -n=${fixtureName}`, {log:true})
Expand Down

0 comments on commit 88ba89f

Please sign in to comment.