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 1 commit
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-*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit naughty, if I have downloaded any job results separate to testing it will delete these also. Can't we work out the job folder from the job id?

}
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a correct comment?

create_node requester,compute

# source $BACALHAU_DIR/bacalhau.run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented out code

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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to jq can just be 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