Skip to content

Commit

Permalink
rename the container to surrealdb to be same as on the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Sep 16, 2024
1 parent 8808a94 commit c07cba3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
2 changes: 1 addition & 1 deletion docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

```
docker volume create my-surreal-db
docker run --detach --restart always --name surreal -p 127.0.0.1:8000:8000 --user root -v$(pwd):/external -v my-surreal-db:/database surrealdb/surrealdb:v1.5.5 start --user root --pass root --log trace file://database
docker run --detach --restart always --name surrealdb -p 127.0.0.1:8000:8000 --user root -v$(pwd):/external -v my-surreal-db:/database surrealdb/surrealdb:v1.5.5 start --user root --pass root --log trace file://database
```

* Note: At the end of the development session you might want to stop the docker container.
Expand Down
2 changes: 1 addition & 1 deletion export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ filename=$(date +%F_%H%M%S)
echo $namespace
echo $database
echo $filename
docker exec -it surreal /surreal export -e http://localhost:8000 --ns $namespace --db $database > backup/backup-$filename.sql
docker exec -it surrealdb /surreal export -e http://localhost:8000 --ns $namespace --db $database > backup/backup-$filename.sql
43 changes: 15 additions & 28 deletions src/test_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,21 @@ pub fn run_inprocess(filename: &str, func: fn(std::path::PathBuf, Client)) {

if !filename.is_empty() {
let path = format!("/external/tests/{filename}");
let result = match std::env::var("CI") {
Ok(_) => std::process::Command::new("surreal")
.arg("import")
.arg("-e")
.arg("http://localhost:8000")
.arg("--namespace")
.arg(&db_namespace)
.arg("--database")
.arg(&db_name)
.arg(&path)
.output()
.unwrap(),

Err(_) => std::process::Command::new("/usr/bin/docker")
.arg("exec")
.arg("surreal")
.arg("/surreal")
.arg("import")
.arg("-e")
.arg("http://localhost:8000")
.arg("--namespace")
.arg(&db_namespace)
.arg("--database")
.arg(&db_name)
.arg(&path)
.output()
.unwrap(),
};

let result = std::process::Command::new("/usr/bin/docker")
.arg("exec")
.arg("surrealdb")
.arg("/surreal")
.arg("import")
.arg("-e")
.arg("http://localhost:8000")
.arg("--namespace")
.arg(&db_namespace)
.arg("--database")
.arg(&db_name)
.arg(&path)
.output()
.unwrap();

println!("result.status: {}", result.status);
println!("STDOUT: {:?}", std::str::from_utf8(&result.stdout));
Expand Down

0 comments on commit c07cba3

Please sign in to comment.