Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Basic Bashtub tests #3669

Merged
merged 3 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-${job_id%%-*}
}
13 changes: 13 additions & 0 deletions test/hello-world-docker-v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!bin/bashtub

source bin/bacalhau.sh

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

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!
Loading