-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more tests for before/after service orderings
- Loading branch information
Showing
7 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
cd "$(dirname "$0")" | ||
. ../igr_functions.sh | ||
|
||
# Tests around before/after link functionality. | ||
|
||
rm -rf "$IGR_OUTPUT"/output/* | ||
|
||
spawn_dinit | ||
|
||
# service2 depends on service1, and service1 is "before" service2 | ||
|
||
run_dinitctl $QUIET reload service2 | ||
|
||
# however, we'll remove the depends-on dependency before starting both | ||
run_dinitctl $QUIET rm-dep regular service2 service1 | ||
|
||
run_dinitctl $QUIET start --no-wait service1 | ||
run_dinitctl $QUIET start service2 | ||
|
||
|
||
# Note service1 takes longer to start, but has a "before" service2 so should still start first. | ||
if ! compare_text "$IGR_OUTPUT"/output/script-output "$(printf "one\ntwo\n")"; then | ||
error "$IGR_OUTPUT/output/script-output didn't contain expected result!" | ||
fi | ||
|
||
rm "$IGR_OUTPUT"/output/script-output | ||
|
||
stop_dinit | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
sleep "$2" | ||
echo "$1" >> "$IGR_OUTPUT"/output/script-output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
type = internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type = scripted | ||
command = scripts/service.sh one 0.5 | ||
before = service2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type = scripted | ||
command = scripts/service.sh two 0.2 | ||
depends-on = service1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters