-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: remove github services for devcontainers
- Loading branch information
Showing
9 changed files
with
90 additions
and
25 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
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
Empty file.
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,45 @@ | ||
use std::fs::File; | ||
use std::io::Write; | ||
|
||
use tempfile::tempdir; | ||
use testcontainers::{ | ||
core::{IntoContainerPort, WaitFor}, | ||
Container, GenericImage, ImageExt, | ||
}; | ||
use testcontainers_modules::postgres::Postgres; | ||
use testcontainers_modules::{postgres, testcontainers::runners::SyncRunner}; | ||
|
||
pub(crate) fn postgres_container() -> Container<Postgres> { | ||
postgres::Postgres::default() | ||
.with_env_var("POSTGRES_DB", "demo") | ||
.with_env_var("POSTGRES_USER", "demo") | ||
.with_env_var("POSTGRES_PASSWORD", "demo_password") | ||
.start() | ||
.expect("PostgreSQL database started") | ||
} | ||
|
||
pub(crate) fn vault_container() -> Container<GenericImage> { | ||
GenericImage::new("hashicorp/vault", "1.17.1") | ||
.with_exposed_port(8200.tcp()) | ||
.with_wait_for(WaitFor::message_on_stdout( | ||
"==> Vault server started! Log data will stream in below", | ||
)) | ||
.with_env_var("VAULT_DEV_ROOT_TOKEN_ID", "root-token") | ||
.start() | ||
.expect("Vault started") | ||
} | ||
|
||
pub(crate) fn write_string_to_tempfile(content: &str) -> String { | ||
let temp_dir = tempdir().expect("Failed to get tmp dir"); | ||
let filename = format!("temp_file_{}", rand::random::<u64>()); | ||
|
||
let mut filepath = temp_dir.path().to_path_buf(); | ||
filepath.push(filename); | ||
|
||
let mut file = File::create(&filepath).expect("Failed to create tmp file"); | ||
|
||
file.write_all(content.as_bytes()) | ||
.expect("Failed to write into tmp file"); | ||
|
||
filepath.to_string_lossy().to_string() | ||
} |
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