Skip to content

Commit

Permalink
Nits from #1219 (backport #1243) (#1245)
Browse files Browse the repository at this point in the history
- use a single `join` call to construct path to migrations
 - remove `sql_migrations_path` config option from interop aggregator

See #1240
  • Loading branch information
tgeoghegan authored Apr 13, 2023
1 parent bdaa19e commit 259254b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions aggregator/src/datastore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5079,8 +5079,7 @@ pub mod test_util {
// changes to the migration scripts will be picked up by every run of the tests.
let migrations_path = PathBuf::from_str(env!("CARGO_MANIFEST_DIR"))
.unwrap()
.join("..")
.join("db");
.join("../db");
let migrator = Migrator::new(migrations_path).await.unwrap();
migrator.run(&mut connection).await.unwrap();

Expand Down
1 change: 0 additions & 1 deletion interop_binaries/config/janus_interop_aggregator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ health_check_listen_address: 0.0.0.0:8000
logging_config:
force_json_output: true
listen_address: 0.0.0.0:8080
sql_migrations_source: /etc/janus/migrations
9 changes: 4 additions & 5 deletions interop_binaries/src/bin/janus_interop_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use sqlx::{migrate::Migrator, Connection, PgConnection};
use std::{
collections::{HashMap, HashSet},
net::SocketAddr,
path::PathBuf,
path::Path,
sync::Arc,
};
use tokio::sync::Mutex;
Expand Down Expand Up @@ -318,9 +318,6 @@ struct Config {
/// Path prefix, e.g. `/dap/`, to serve DAP from.
#[serde(default = "default_dap_serving_prefix")]
dap_serving_prefix: String,

/// Path at which `sqlx` migration files can be found. Migrations will be applied at startup.
sql_migrations_source: PathBuf,
}

impl BinaryConfig for Config {
Expand All @@ -341,7 +338,9 @@ async fn main() -> anyhow::Result<()> {
// Apply SQL migrations to database
let mut connection =
PgConnection::connect(ctx.config.common_config.database.url.as_str()).await?;
let migrator = Migrator::new(ctx.config.sql_migrations_source).await?;
// Migration scripts are mounted into the container at this path by
// Dockerfile.interop_aggregator
let migrator = Migrator::new(Path::new("/etc/janus/migrations")).await?;
migrator.run(&mut connection).await?;

// Run an HTTP server with both the DAP aggregator endpoints and the interoperation test
Expand Down

0 comments on commit 259254b

Please sign in to comment.