-
Notifications
You must be signed in to change notification settings - Fork 90
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
Bashtub Tests Working #4586
Bashtub Tests Working #4586
Changes from 3 commits
5d0688a
60482d3
d2219bd
409ae9e
c1ec5c0
ba4ebd6
f492f7e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
build_bacalhau() { | ||
make build | ||
} | ||
|
||
|
||
bash_test() { | ||
make bash-test | ||
} | ||
|
||
|
||
main () { | ||
build_bacalhau | ||
bash_test | ||
} | ||
|
||
main |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,17 @@ import ( | |
var Fatal = fatalError | ||
|
||
func fatalError(cmd *cobra.Command, err error, code int) { | ||
cmd.PrintErrln() | ||
cmd.SetOut(os.Stdout) | ||
cmd.Println() | ||
|
||
var bErr bacerrors.Error | ||
if errors.As(err, &bErr) { | ||
// Print error message | ||
cmd.PrintErrln(output.RedStr("Error: ") + bErr.Error()) | ||
cmd.Println(output.RedStr("Error: ") + bErr.Error()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are we switching from stderr to stdout for error messages? It doesn't sound the right thing to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed reverting it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not reverted yet! |
||
|
||
// Print hint if available | ||
if bErr.Hint() != "" { | ||
cmd.PrintErrln(output.GreenStr("Hint: ") + bErr.Hint()) | ||
cmd.Println(output.GreenStr("Hint: ") + bErr.Hint()) | ||
} | ||
|
||
// If debug mode, then print details and stack trace | ||
|
@@ -37,14 +38,14 @@ func fatalError(cmd *cobra.Command, err error, code int) { | |
} | ||
stackTrace := bErr.StackTrace() | ||
if stackTrace != "" { | ||
cmd.PrintErrln() | ||
cmd.PrintErrln(output.YellowStr("Stack Trace:")) | ||
cmd.PrintErrln(stackTrace) | ||
cmd.Println() | ||
cmd.Println(output.YellowStr("Stack Trace:")) | ||
cmd.Println(stackTrace) | ||
} | ||
} | ||
|
||
} else { | ||
cmd.PrintErrln(output.RedStr("Error: ") + err.Error()) | ||
cmd.Println(output.RedStr("Error: ") + err.Error()) | ||
} | ||
os.Exit(code) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,3 @@ testcase_config_with__defaults() { | |
|
||
kill $SERVER_PID | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,54 +3,39 @@ | |
source bin/bacalhau.sh | ||
|
||
testcase_node_can_connect_without_token() { | ||
subject bacalhau config set node.network.type nats | ||
create_node requester | ||
create_node orchestrator | ||
|
||
create_node compute | ||
# If this returns successfully, the node started and authenticated. | ||
} | ||
|
||
testcase_preconfigured_token_not_printed() { | ||
subject bacalhau config set node.network.type nats | ||
subject bacalhau config set node.network.authsecret kerfuffle | ||
subject ${BACALHAU} config set orchestrator.auth.token kerfuffle | ||
assert_equal 0 $status | ||
|
||
create_node requester | ||
assert_equal 0 $status | ||
|
||
# check stdout | ||
subject grep BACALHAU_NODE_NETWORK_ORCHESTRATORS $BACALHAU_DIR/out.log | ||
assert_equal 0 $status | ||
assert_not_match kerfuffle $stdout | ||
|
||
# check bacalhau.run | ||
subject grep BACALHAU_NODE_NETWORK_ORCHESTRATORS $BACALHAU_DIR/bacalhau.run | ||
create_node orchestrator | ||
assert_equal 0 $status | ||
assert_not_match kerfuffle $stdout | ||
} | ||
|
||
testcase_node_connects_with_preconfigured_token() { | ||
subject bacalhau config set node.network.type nats | ||
subject bacalhau config set node.network.authsecret kerfuffle | ||
subject ${BACALHAU} config set orchestrator.auth.token kerfuffle | ||
assert_match 0 $status | ||
create_node requester | ||
create_node orchestrator | ||
|
||
subject bacalhau config set node.network.authsecret kerfuffle | ||
subject bacalhau config set node.network.type nats | ||
subject ${BACALHAU} config set orchestrator.auth.token kerfuffle | ||
create_node compute | ||
# If this returns successfully, the node started and authenticated. | ||
Comment on lines
-39
to
28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this should pass. We are setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not addressed yet! |
||
} | ||
|
||
testcase_node_connects_with_url_embedded_token() { | ||
subject bacalhau config set node.network.type nats | ||
subject bacalhau config set node.network.authsecret kerfuffle | ||
subject ${BACALHAU} config set orchestrator.auth.token kerfuffle | ||
assert_match 0 $status | ||
create_node requester | ||
create_node orchestrator | ||
|
||
|
||
# remove the token from the config | ||
subject bacalhau config set node.network.authsecret "" | ||
subject bacalhau config set node.network.type nats | ||
subject ${BACALHAU} config set orchestrator.auth.token "" | ||
|
||
# add the token to the orchestrator URL | ||
export BACALHAU_NODE_NETWORK_ORCHESTRATORS=$(echo $BACALHAU_NODE_NETWORK_ORCHESTRATORS | sed "s|nats://|nats://kerfuffle@|") | ||
|
@@ -60,14 +45,12 @@ testcase_node_connects_with_url_embedded_token() { | |
} | ||
|
||
testcase_node_cannot_connect_with_wrong_token() { | ||
subject bacalhau config set node.network.type nats | ||
subject bacalhau config set node.network.authsecret kerfuffle | ||
subject ${BACALHAU} config set orchestrator.auth.token kerfuffle | ||
assert_match 0 $status | ||
create_node requester | ||
create_node orchestrator | ||
|
||
subject bacalhau config set node.network.type nats | ||
subject bacalhau config set node.network.authsecret kerfalafel | ||
subject bacalhau serve --node-type compute | ||
export BACALHAU_DIR=$(mktemp -d) | ||
subject ${BACALHAU} serve --compute 1>$BACALHAU_DIR/out.log 2>$BACALHAU_DIR/err.log | ||
assert_not_equal 0 $status | ||
assert_match "nats: Authorization Violation" $stderr | ||
assert_match "nats: Authorization Violation" $stdout | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think setting the writer here is necessary as we are already doing that in cli/root
bacalhau/cmd/cli/root.go
Lines 136 to 137 in 48dc1a7