Skip to content

Commit

Permalink
More Bashtub tests
Browse files Browse the repository at this point in the history
  • Loading branch information
js-ts committed Mar 29, 2024
1 parent feb399d commit 584ae15
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/connect_to_external_cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!bin/bashtub

source bin/bacalhau.sh

testcase_can_run_docker_hello_world_external_cluster() {
export BACALHAU_NODE_CLIENTAPI_HOST=34.86.177.175
export BACALHAU_NODE_CLIENTAPI_PORT=1234
export BACALHAU_NODE_NETWORK_TYPE=nats
export BACALHAU_NODE_NETWORK_ORCHESTRATORS=35.245.221.171:4222
bacalhau job run --follow $ROOT/testdata/jobs/docker-hello.yaml
subject bacalhau job run --follow $ROOT/testdata/jobs/docker-hello.yaml
assert_equal 0 $status
assert_match "Hello Bacalhau!" $(echo $stdout)
assert_equal '' $stderr
}
13 changes: 13 additions & 0 deletions test/get-job-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!bin/bashtub

source bin/bacalhau.sh

testcase_can_get_logs() {
# Assuming create_node is a function that takes two arguments separated by space, not comma
create_node requester,compute
job_id=$(bacalhau job run --id-only $ROOT/testdata/jobs/docker-hello.yaml)
subject bacalhau job logs $job_id
assert_equal 0 $status
assert_match "Hello Bacalhau!" $(echo $stdout | xargs)
assert_equal '' $stderr
}
18 changes: 18 additions & 0 deletions test/get-job-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!bin/bashtub

source bin/bacalhau.sh

testcase_can_get_results() {
# Assuming create_node is a function that takes two arguments separated by space, not comma
create_node requester,compute

job_id=$(bacalhau job run --id-only $ROOT/testdata/jobs/docker-output.yaml)
bacalhau get $job_id > /dev/null 2>&1
subject cat job-*/output_custom/output.txt
assert_equal 0 $status
assert_match "15" $(echo $stdout)
assert_equal '' $stderr
extracted_id=$(echo $job_id | awk -F'-' '{print $1"-"$2}')
rm -rf job-$extracted_id

}
13 changes: 13 additions & 0 deletions test/job_describe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!bin/bashtub

source bin/bacalhau.sh

testcase_can_describe_jobs() {
# Assuming create_node is a function that takes two arguments separated by space, not comma
create_node requester,compute
job_id=$(bacalhau job run --id-only $ROOT/testdata/jobs/docker-hello.yaml)
subject bacalhau job describe --output json $job_id
assert_equal 0 $status
assert_match $job_id $(jq -r '.Job.ID' <<< "$stdout")
assert_equal '' $stderr
}
13 changes: 13 additions & 0 deletions test/job_executions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!bin/bashtub

source bin/bacalhau.sh

testcase_can_describe_jobs() {
# Assuming create_node is a function that takes two arguments separated by space, not comma
create_node requester,compute
job_id=$(bacalhau job run --id-only $ROOT/testdata/jobs/docker-hello.yaml)
subject bacalhau job executions --output json $job_id
assert_equal 0 $status
assert_match $job_id $(jq -r '.[0].JobID' <<< "$stdout")
assert_equal '' $stderr
}

0 comments on commit 584ae15

Please sign in to comment.