Repository: shuttle-hq/synth (rust)

Issue:
nix builds failing
**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
1. CI tries to build for nix
2. See error
```
error: failed to run custom build command for `openssl-sys v0.9.75`

Caused by:
  process didn't exit successfully: `/build/dummy-src/target/release/build/openssl-sys-4e4eb3d5fcef2aa7/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = Some("gcc")
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running "perl" "./Configure" "--prefix=/build/dummy-src/target/release/build/openssl-sys-e8ec31a2c8346d81/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /sources/openssl-src-111.22.0+1.1.1q/src/lib.rs:488:39
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
[naersk] cargo returned with exit code 101, exiting
error: builder for '/nix/store/0503sw0c5dwmimylw6xyg7hq92jwz5rl-synth-deps-0.6.2.drv' failed with exit code 101;
       last 10 log lines:
       >   DEBUG = Some("false")
       >   CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
       >   running "perl" "./Configure" "--prefix=/build/dummy-src/target/release/build/openssl-sys-e8ec31a2c8346d81/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
       >
       >   --- stderr
       >   thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /sources/openssl-src-111.22.0+1.1.1q/src/lib.rs:488:39
       >   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
       > warning: build failed, waiting for other jobs to finish...
       > error: build failed
       > [naersk] cargo returned with exit code 101, exiting
       For full logs, run 'nix log /nix/store/0503sw0c5dwmimylw6xyg7hq92jwz5rl-synth-deps-0.6.2.drv'.
error: 1 dependencies of derivation '/nix/store/bilryl1pvz15p3fc20f2i45g3mhr2ijj-synth-0.6.2.drv' failed to build
```

**Expected behavior**
The build was expected to succeed.

**Additional context**
This looks like a problem with our integration with OpenSSL.



Discussion:

Patch:
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -234,18 +234,6 @@ dependencies = [
  "event-listener",
 ]
 
-[[package]]
-name = "async-native-tls"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e9e7a929bd34c68a82d58a4de7f86fffdaf97fb2af850162a7bb19dd7269b33"
-dependencies = [
- "async-std",
- "native-tls",
- "thiserror",
- "url",
-]
-
 [[package]]
 name = "async-process"
 version = "1.2.0"
@@ -263,6 +251,17 @@ dependencies = [
  "winapi",
 ]
 
+[[package]]
+name = "async-rustls"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c86f33abd5a4f3e2d6d9251a9e0c6a7e52eb1113caf893dae8429bf4a53f378"
+dependencies = [
+ "futures-lite",
+ "rustls",
+ "webpki",
+]
+
 [[package]]
 name = "async-session"
 version = "2.0.1"
@@ -585,9 +584,6 @@ name = "cc"
 version = "1.0.70"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"
-dependencies = [
- "jobserver",
-]
 
 [[package]]
 name = "cfg-if"
@@ -1302,21 +1298,6 @@ version = "0.25.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7"
 
-[[package]]
-name = "git2"
-version = "0.13.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "659cd14835e75b64d9dba5b660463506763cf0aa6cb640aeeb0e98d841093490"
-dependencies = [
- "bitflags",
- "libc",
- "libgit2-sys",
- "log",
- "openssl-probe",
- "openssl-sys",
- "url",
-]
-
 [[package]]
 name = "globset"
 version = "0.4.8"
@@ -1702,15 +1683,6 @@ version = "0.4.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
 
-[[package]]
-name = "jobserver"
-version = "0.1.24"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
-dependencies = [
- "libc",
-]
-
 [[package]]
 name = "js-sys"
 version = "0.3.53"
@@ -1744,52 +1716,12 @@ version = "0.2.101"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21"
 
-[[package]]
-name = "libgit2-sys"
-version = "0.12.22+1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89c53ac117c44f7042ad8d8f5681378dfbc6010e49ec2c0d1f11dfedc7a4a1c3"
-dependencies = [
- "cc",
- "libc",
- "libssh2-sys",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
-]
-
 [[package]]
 name = "libm"
 version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
 
-[[package]]
-name = "libssh2-sys"
-version = "0.2.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0186af0d8f171ae6b9c4c90ec51898bad5d08a2d5e470903a50d9ad8959cbee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
-name = "libz-sys"
-version = "1.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
 [[package]]
 name = "linked-hash-map"
 version = "0.5.4"
@@ -2188,15 +2120,6 @@ version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
 
-[[package]]
-name = "openssl-src"
-version = "111.22.0+1.1.1q"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853"
-dependencies = [
- "cc",
-]
-
 [[package]]
 name = "openssl-sys"
 version = "0.9.75"
@@ -2206,7 +2129,6 @@ dependencies = [
  "autocfg 1.0.1",
  "cc",
  "libc",
- "openssl-src",
  "pkg-config",
  "vcpkg",
 ]
@@ -3111,6 +3033,7 @@ dependencies = [
  "rand 0.8.4",
  "rsa",
  "rust_decimal",
+ "rustls",
  "serde",
  "serde_json",
  "sha-1",
@@ -3121,6 +3044,8 @@ dependencies = [
  "stringprep",
  "thiserror",
  "url",
+ "webpki",
+ "webpki-roots",
  "whoami",
 ]
 
@@ -3150,9 +3075,8 @@ version = "0.5.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "14302b678d9c76b28f2e60115211e25e0aabc938269991745a169753dc00e35c"
 dependencies = [
- "async-native-tls",
+ "async-rustls",
  "async-std",
- "native-tls",
 ]
 
 [[package]]
@@ -3318,14 +3242,12 @@ dependencies = [
  "env_logger",
  "fs2",
  "futures",
- "git2",
  "iai",
  "indicatif",
  "lazy_static",
  "log",
  "mongodb",
  "num_cpus",
- "openssl",
  "paste",
  "posthog-rs",
  "querystring",
diff --git a/core/Cargo.toml b/core/Cargo.toml
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -35,6 +35,6 @@ bimap = { version = "0.6.0", features = [ "std" ] }
 humantime-serde = "1.0.1"
 bloomfilter = "1.0.5"
 dynfmt = { version = "0.1.5", features = [ "curly" ] }
-sqlx = { version = "0.5.7", features = [ "postgres", "mysql", "runtime-async-std-native-tls", "decimal", "chrono" ] }
+sqlx = { version = "0.5.7", features = [ "postgres", "mysql", "runtime-async-std-rustls", "decimal", "chrono" ] }
 uriparse = "0.6.3"
 paste = "1.0"
diff --git a/docs/docs/integrations/mysql.md b/docs/docs/integrations/mysql.md
new file mode 100644
--- /dev/null
+++ b/docs/docs/integrations/mysql.md
@@ -0,0 +1,107 @@
+---
+title: MySQL
+---
+
+:::note
+
+The Synth MySQL integration is currently **in beta**.
+
+:::
+
+## Usage
+
+`synth` can use [MySQL](https://www.mysql.org/) as a data source or
+sink. Connecting `synth` to a MySQL is as simple as specifying a URI
+and schema during the `import` or `generate`
+phase.
+
+### URI format
+
+```bash
+mysql://<username>:<password>@<host>:<port>/<catalog>
+```
+One [quirk](https://github.com/launchbadge/sqlx/issues/846) with the 
+current MySQL integration is that the host can't be represented in IPv4,
+so DNS or IPv6 representations should be used instead. 
+If IPv4 compatibility is wanted, use [IPv4-mapped IPv6](https://serverfault.com/a/1102261).
+
+## Import
+
+`synth` can import directly from a [MySQL](https://www.mysql.org/)
+database and create a data model from the database schema. During import, a
+new [namespace](../getting_started/core-concepts#namespaces)
+will be created from your database schema, and
+a [collection](../getting_started/core-concepts#collections) is created for each
+table in a separate JSON file. `synth` will map database columns to fields in
+the collections it creates. It then provides default generators for every
+collection. Synth will default to the `public` schema but this can be
+overriden with the `--schema` flag.
+
+`synth` will automatically detect primary key and foreign key constraints at
+import time and update the namespace and collection to reflect them. **Primary
+keys** get mapped to `synth`'s [id](../content/number#id)
+generator, and **foreign keys** get mapped to the [same_as](../content/same-as.md)
+generator.
+
+Finally `synth` will sample data randomly from every table in order to create a
+more realistic data model by automatically inferring bounds on types.
+
+`synth` has its own internal data model, and so does MySQL, therefore a
+conversion occurs between `synth` types and MySQL types. The inferred type
+can be seen below. The synth types link to default generator *variant*
+generated during the `import` process for that PostgreSQL type.
+
+Note, not all MySQL types have been covered yet. If there is a type you
+need, [open an issue](https://github.com/getsynth/synth/issues/new?assignees=&labels=New+feature&template=feature_request.md&title=)
+on GitHub.
+
+<!---
+table formatter: https://codebeautify.org/markdown-formatter
+-->
+
+| MySQL Type | Synth Type                                                  |
+| --------------- | ------------------------------------------------------- |
+| char            | [string](../content/string#pattern)                     |
+| varchar(x)      | [string](../content/string#pattern)                     |
+| text            | [string](../content/string#pattern)                     |
+| enum            | [string](../content/string#pattern)                     |
+| int             | [i32](../content/number#range)                          |
+| integer         | [i32](../content/number#range)                          |
+| tinyint         | [i8](../content/number#range)                           |
+| bigint          | [i64](../content/number#range)                          |
+| serial          | [u64](../content/number#range)                          |
+| float           | [f32](../content/number#range)                          |
+| double          | [f64](../content/number#range)                          |
+| numeric         | [f64](../content/number#range)                          |
+| decimal         | [f64](../content/number#range)                          |
+| timestamp       | [date_time](../content/date-time)                |
+| datetime        | [naive_date_time](../content/date-time)          |
+| date            | [naive_date](../content/date-time)               |
+| time            | [naive_time](../content/date-time)                          |
+
+```
+### Example Import Command
+
+```bash
+synth import --from mysql://user:pass@localhost:5432/postgres --schema
+main my_namespace
+```
+
+### Example
+
+## Generate
+
+`synth` can generate data directly into your MySQL database. First `synth`
+will generate as much data as required, then open a connection to your database,
+and then perform batch insert to quickly insert as much data as you need.
+
+`synth` will also respect primary key and foreign key constraints, by performing
+a [topological sort](https://en.wikipedia.org/wiki/Topological_sorting) on the
+data and inserting it in the right order such that no constraints are violated.
+
+### Example Generation Command
+
+```bash
+synth generate --to mysql://user:pass@localhost:5432/ --schema
+main my_namespace
+```
diff --git a/docs/docs/other/telemetry.md b/docs/docs/other/telemetry.md
--- a/docs/docs/other/telemetry.md
+++ b/docs/docs/other/telemetry.md
@@ -66,12 +66,7 @@ Synth's telemetry collects 8 fields:
   - `telemetry::disabled`
 - `success`: If the command completed in success.
 - `version`: The current semver of Synth. For example `v0.4.3`.
-- `os`: The target platform for which the binary was built. This is the value
-  of `cargo`'s `CARGO_CFG_TARGET_OS` environment variable under which `synth`
-  was built in CI/CD. Currently, this is one of:
-  - `linux`
-  - `windows`
-  - `macos`
+- `os`: The target platform for which the binary was built. This value is [std::env::consts::OS](https://doc.rust-lang.org/std/env/consts/constant.OS.html), a constant set at compile time. For example `windows`.
 - `timestamp`: The time at which the command was issued. For
   example `2021-05-06T16:13:40.084Z`.
 - `generators`: A list of generators that were used by the `generate` command. For example `string::title, number::I32::Range`.
diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js
--- a/docs/docusaurus.config.js
+++ b/docs/docusaurus.config.js
@@ -121,8 +121,12 @@ module.exports = {
                         },
                         {
                             to: '/docs/integrations/postgres',
-                            label: 'Integrations'
-                        }
+                            label: 'Postgres Integration'
+                        },
+			{
+			    to: '/docs/integrations/mysql',
+			    label: 'MySQL Integration'
+			}
                     ],
                 },
                 {
diff --git a/docs/sidebars.js b/docs/sidebars.js
--- a/docs/sidebars.js
+++ b/docs/sidebars.js
@@ -3,7 +3,7 @@ module.exports = {
         "Getting Started": ['getting_started/synth', 'getting_started/installation', 'getting_started/hello-world', 'getting_started/core-concepts', 'getting_started/schema', 'getting_started/command-line', 'getting_started/how-it-works'],
         "Examples": ['examples/bank'],
         "Tutorials": ['tutorials/creating-logs-with-synth'],
-        "Integrations": ['integrations/postgres'],
+        "Integrations": ['integrations/postgres', 'integrations/mysql'],
         "Generators": ['content/index', 'content/modifiers', 'content/null', 'content/bool', 'content/number', 'content/string', 'content/date-time', 'content/object', 'content/array', 'content/one-of', 'content/same-as', 'content/unique', 'content/series', 'content/datasource'],
         "Other": ['other/telemetry']
     },
diff --git a/synth/Cargo.toml b/synth/Cargo.toml
--- a/synth/Cargo.toml
+++ b/synth/Cargo.toml
@@ -19,15 +19,6 @@ harness = false
 default = []
 telemetry = ["posthog-rs", "uuid", "backtrace", "console"]
 
-[build-dependencies]
-git2 = "0.13.20"
-#until https://github.com/rust-lang/git2-rs/issues/623 fixed
-[dependencies.openssl]
-version = "0.10.41"
-features = [
-    "vendored"
-]
-
 [dev-dependencies]
 lazy_static = "1.4.0"
 tempfile = "3.1.0"
@@ -78,11 +69,11 @@ indicatif = "0.15.0"
 dirs = "3.0.2"
 mongodb = {version = "2.0.0-beta.3", features = ["sync", "bson-chrono-0_4"] , default-features = false}
 
-sqlx = { version = "0.5.7", features = [ "postgres", "mysql", "runtime-async-std-native-tls", "decimal", "chrono" ] }
+sqlx = { version = "0.5.7", features = [ "postgres", "mysql", "runtime-async-std-rustls", "decimal", "chrono" ] }
 
 beau_collector = "0.2.1"
 
-reqwest = { version = "0.11", features = ["json", "blocking","rustls-tls"] }
+reqwest = { version = "0.11", default-features = false, features = ["json", "blocking","rustls-tls"] }
 
 semver = "1.0.4"
 
diff --git a/synth/build.rs b/synth/build.rs
deleted file mode 100644
--- a/synth/build.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-use std::env;
-use std::fs::File;
-use std::io::Write;
-use std::path::PathBuf;
-
-use git2::Repository;
-
-fn git_data(repo_src: PathBuf) -> Result<(String, String), Box<dyn std::error::Error>> {
-    let repo = Repository::open(repo_src)?;
-    let head = repo.head()?;
-    let oid = head.target().expect("a valid oid").to_string();
-    let shortname = head.shorthand().expect("a valid shortname").to_string();
-    Ok((oid, shortname))
-}
-
-fn main() -> Result<(), Box<dyn std::error::Error>> {
-    let repo_src = PathBuf::from(&env::var("SYNTH_SRC").unwrap_or_else(|_| "./.".to_string()));
-    let (oid, shortname) =
-        git_data(repo_src).unwrap_or_else(|_| ("unknown".to_string(), "unknown".to_string()));
-    let os = env::var("CARGO_CFG_TARGET_OS").unwrap();
-    let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
-    let mut f = File::create(format!("{}/meta.rs", env::var("OUT_DIR").unwrap()))?;
-    write!(
-        f,
-        r#"#[allow(dead_code)] pub const META_OID: &str = "{}";
-        #[allow(dead_code)] pub const META_SHORTNAME: &str = "{}";
-        #[allow(dead_code)] pub const META_OS: &str = "{}";
-        #[allow(dead_code)] pub const META_ARCH: &str = "{}";"#,
-        oid, shortname, os, arch,
-    )?;
-    Ok(())
-}
diff --git a/synth/src/cli/telemetry.rs b/synth/src/cli/telemetry.rs
--- a/synth/src/cli/telemetry.rs
+++ b/synth/src/cli/telemetry.rs
@@ -399,7 +399,7 @@ pub(crate) struct TelemetryClient {
 impl TelemetryClient {
     fn new() -> Self {
         let synth_version = version();
-        let os = META_OS.to_string();
+        let os = std::env::consts::OS.to_string();
 
         Self {
             ph_client: posthog_rs::client(API_KEY),
diff --git a/synth/src/utils.rs b/synth/src/utils.rs
--- a/synth/src/utils.rs
+++ b/synth/src/utils.rs
@@ -4,8 +4,6 @@ use std::str::FromStr;
 
 use anyhow::Result;
 
-include!(concat!(env!("OUT_DIR"), "/meta.rs"));
-
 pub struct DataDirectoryPath(PathBuf);
 
 impl Default for DataDirectoryPath {
@@ -37,13 +35,10 @@ pub mod splash {
     use colored::Colorize;
     use sysinfo::{System, SystemExt};
 
-    use super::*;
     use crate::version::version;
 
     pub struct Splash {
         synth_ver: String,
-        synth_ref: String,
-        synth_rev: String,
         path: String,
         os: String,
         arch: String,
@@ -56,18 +51,14 @@ pub mod splash {
 
             let synth_ver = version();
 
-            let synth_ref = META_SHORTNAME.to_string();
-            let synth_rev = META_OID.to_string();
-            let os = META_OS.to_string();
-            let arch = META_ARCH.to_string();
+            let os = std::env::consts::OS.to_string();
+            let arch = std::env::consts::ARCH.to_string();
 
             let system = System::new_all();
             let mem = system.get_total_memory();
 
             Ok(Self {
                 synth_ver,
-                synth_ref,
-                synth_rev,
                 path,
                 os,
                 arch,
@@ -83,8 +74,6 @@ pub mod splash {
                 "
 
 version     = {synth_ver}
-ref         = {synth_ref}
-rev         = {synth_rev}
 PATH        = {path}
 target      = {os}
 arch        = {arch}
@@ -92,8 +81,6 @@ threads     = {cpu}
 mem         = {mem}
 ",
                 synth_ver = self.synth_ver.blue().bold(),
-                synth_ref = self.synth_ref.bold(),
-                synth_rev = self.synth_rev.bold(),
                 path = self.path.bold(),
                 arch = self.arch.bold(),
                 os = self.os.bold(),


Test patch:
diff --git a/synth/testing_harness/mysql/e2e.sh b/synth/testing_harness/mysql/e2e.sh
--- a/synth/testing_harness/mysql/e2e.sh
+++ b/synth/testing_harness/mysql/e2e.sh
@@ -42,7 +42,7 @@ function load-schema() {
 function test-generate() {
   echo -e "${INFO}Test generate${NC}"
   load-schema --no-data || { echo -e "${ERROR}Failed to load schema${NC}"; return 1; }
-  $SYNTH generate hospital_master --to $SCHEME://root:${PASSWORD}@127.0.0.1:${PORT}/test_db --size 30 || return 1
+  $SYNTH generate hospital_master --to $SCHEME://root:${PASSWORD}@localhost:${PORT}/test_db --size 30 || return 1
 
   sum_rows_query="SELECT (SELECT count(*) FROM hospitals) +  (SELECT count(*) FROM doctors) + (SELECT count(*) FROM patients)"
   sum=`docker exec -i $NAME mysql -h 127.0.0.1 -u root --password=$PASSWORD -P 3306 "test_db" -e "$sum_rows_query" | grep -o '[[:digit:]]*'`
@@ -52,7 +52,7 @@ function test-generate() {
 function test-import() {
   echo -e "${INFO}Testing import${NC}"
   load-schema --all || { echo -e "${ERROR}Failed to load schema${NC}"; return 1; }
-  $SYNTH import --from $SCHEME://root:${PASSWORD}@127.0.0.1:${PORT}/test_db hospital_import || { echo -e "${ERROR}Import failed${NC}"; return 1; }
+  $SYNTH import --from $SCHEME://root:${PASSWORD}@localhost:${PORT}/test_db hospital_import || { echo -e "${ERROR}Import failed${NC}"; return 1; }
   diff <(jq --sort-keys . hospital_import/*) <(jq --sort-keys . hospital_master/*) || { echo -e "${ERROR}Import namespaces do not match${NC}"; return 1; }
 }
 
@@ -70,7 +70,7 @@ function test-warning() {
   echo -e "${INFO}[$folder] Testing warning${NC}"
 
   docker exec -i $NAME mysql -h 127.0.0.1 -u root --password=$PASSWORD -P 3306 "test_db" < "$folder/schema.sql"
-  output=$($SYNTH generate --size 10 --to $SCHEME://root:${PASSWORD}@127.0.0.1:${PORT}/test_db "$folder" 2>&1)
+  output=$($SYNTH generate --size 10 --to $SCHEME://root:${PASSWORD}@localhost:${PORT}/test_db "$folder" 2>&1)
   warnings=$(echo "$output" | grep "WARN" | grep -Po "(?<=\]\s).*$")
 
   if [ -z "$warnings" ]