-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: testcontainers integration (#386)
- closes #382
- Loading branch information
Showing
20 changed files
with
705 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@fuel-bridge/solidity-contracts': minor | ||
'@fuel-bridge/test-utils': minor | ||
--- | ||
|
||
testcontainer integration for all intergration tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { config as dotEnvConfig } from 'dotenv'; | ||
import * as path from 'path'; | ||
import type { | ||
StartedTestContainer, | ||
StartedDockerComposeEnvironment, | ||
} from 'testcontainers'; | ||
import { DockerComposeEnvironment } from 'testcontainers'; | ||
|
||
dotEnvConfig(); | ||
|
||
export type Containers = { | ||
postGresContainer: StartedTestContainer; | ||
l1_node: StartedTestContainer; | ||
fuel_node: StartedTestContainer; | ||
block_committer: StartedTestContainer; | ||
}; | ||
|
||
const PROJECT_ROOT = path.resolve(__dirname, '../../../'); | ||
let environment: StartedDockerComposeEnvironment; | ||
|
||
// responsible for starting all containers | ||
export async function startContainers() { | ||
// building images externally | ||
console.log('Setting up environment using docker compose...'); | ||
environment = await new DockerComposeEnvironment( | ||
path.resolve(PROJECT_ROOT, 'docker'), | ||
'docker-compose.yml' | ||
) | ||
.withBuild() | ||
.up(); | ||
|
||
console.log('Environment setup done...'); | ||
|
||
const postGresContainer = environment.getContainer('db-1'); | ||
|
||
const l1_node: StartedTestContainer = environment.getContainer('l1_chain-1'); | ||
const fuel_node: StartedTestContainer = | ||
environment.getContainer('fuel_core-1'); | ||
const block_committer: StartedTestContainer = environment.getContainer( | ||
'fuel_block_commiter-1' | ||
); | ||
|
||
return { postGresContainer, l1_node, fuel_node, block_committer }; | ||
} | ||
|
||
export async function stopEnvironment(): Promise<void> { | ||
console.log('Stopping environment...'); | ||
if (environment) { | ||
await environment.down(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.