Skip to content

Commit

Permalink
Add simple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
js-ts committed Mar 23, 2024
1 parent 6f54e81 commit eb2d605
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/get-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!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
rm -rf job-*
}
14 changes: 14 additions & 0 deletions test/hello-world-docker-v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!bin/bashtub

source bin/bacalhau.sh

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

# source $BACALHAU_DIR/bacalhau.run
subject bacalhau job run --follow $ROOT/testdata/jobs/docker-hello.yaml
assert_equal 0 $status
assert_match "Hello Bacalhau!" $(echo $stdout)
assert_equal '' $stderr
}
12 changes: 12 additions & 0 deletions test/list_nodes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!bin/bashtub

source bin/bacalhau.sh

testcase_can_list_nodes_and_count() {
create_node requester,compute

subject bacalhau node list --output json
assert_equal 0 $status
assert_match '1' $(echo $stdout | jq '. | length')
assert_equal '' $stderr
}
14 changes: 14 additions & 0 deletions testdata/jobs/docker-hello.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: A Simple Docker Job
type: batch
count: 1
tasks:
- name: My main task
engine:
type: docker
params:
Image: ubuntu:latest
Entrypoint:
- /bin/bash
Parameters:
- -c
- echo Hello Bacalhau!

0 comments on commit eb2d605

Please sign in to comment.