docker: Extract complement logs on failure.
docker: Sort config options used during complement. Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
19
.github/workflows/test.yml
vendored
19
.github/workflows/test.yml
vendored
@@ -203,7 +203,8 @@ jobs:
|
||||
run: |
|
||||
docker/complement.sh
|
||||
|
||||
- name: Extract
|
||||
- if: success() || failure() && steps.execute.outcome == 'failure'
|
||||
name: Extract
|
||||
id: extract
|
||||
env:
|
||||
name: complement_tester__${{matrix.sys_name}}__${{matrix.sys_version}}__${{matrix.sys_target}}
|
||||
@@ -213,13 +214,23 @@ jobs:
|
||||
cid=$(cat "$name")
|
||||
docker cp "$cid:/usr/src/complement/new_results.jsonl" tests/test_results/complement/test_results.jsonl
|
||||
|
||||
- name: Upload
|
||||
id: upload
|
||||
- if: success() || failure() && steps.execute.outcome == 'failure'
|
||||
name: Upload New Results
|
||||
id: upload-result
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test_results-${{matrix.feat_set}}-${{matrix.sys_name}}-${{matrix.sys_target}}.jsonl
|
||||
name: complement_results-${{matrix.feat_set}}-${{matrix.sys_name}}-${{matrix.sys_target}}.jsonl
|
||||
path: ./tests/test_results/complement/test_results.jsonl
|
||||
|
||||
- if: failure() && steps.execute.outcome == 'failure'
|
||||
name: Upload Failure Output
|
||||
id: upload-output
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: complement_output-${{matrix.feat_set}}-${{matrix.sys_name}}-${{matrix.sys_target}}.jsonl
|
||||
path: ./complement.jsonl
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Accept
|
||||
id: accept
|
||||
run: |
|
||||
|
||||
@@ -66,49 +66,50 @@ COPY --from=source /usr/src/tuwunel/tests/test_results/complement/test_results.j
|
||||
COPY <<EOF complement.toml
|
||||
[global]
|
||||
address = "0.0.0.0"
|
||||
admin_room_notices = false
|
||||
allow_check_for_updates = false
|
||||
allow_device_name_federation = true
|
||||
allow_guest_registration = true
|
||||
allow_invalid_tls_certificates = true
|
||||
allow_legacy_media = true
|
||||
allow_public_room_directory_over_federation = true
|
||||
allow_public_room_directory_without_auth = true
|
||||
allow_registration = true
|
||||
database_path = "/database"
|
||||
log = "debug,tuwunel=trace,h2=warn,hyper=warn"
|
||||
port = [8008, 8448]
|
||||
trusted_servers = []
|
||||
only_query_trusted_key_servers = false
|
||||
query_trusted_key_servers_first = false
|
||||
query_trusted_key_servers_first_on_join = false
|
||||
yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse = true
|
||||
dns_attempts = 20
|
||||
dns_timeout = 60
|
||||
federation_idle_timeout = 300
|
||||
intentionally_unknown_config_option_for_testing = true
|
||||
ip_range_denylist = []
|
||||
url_preview_domain_contains_allowlist = ["*"]
|
||||
url_preview_domain_explicit_denylist = ["*"]
|
||||
log = "debug,tuwunel=trace,h2=warn,hyper=warn"
|
||||
log_colors = false
|
||||
log_guest_registrations = false
|
||||
log_span_events = "NONE"
|
||||
log_thread_ids = true
|
||||
media_compat_file_link = false
|
||||
media_startup_check = true
|
||||
only_query_trusted_key_servers = false
|
||||
port = [8008, 8448]
|
||||
prune_missing_media = true
|
||||
log_colors = false
|
||||
admin_room_notices = false
|
||||
allow_check_for_updates = false
|
||||
intentionally_unknown_config_option_for_testing = true
|
||||
rocksdb_log_level = "debug"
|
||||
rocksdb_max_log_files = 1
|
||||
rocksdb_recovery_mode = 0
|
||||
rocksdb_paranoid_file_checks = true
|
||||
log_guest_registrations = false
|
||||
allow_legacy_media = true
|
||||
startup_netburst = true
|
||||
startup_netburst_keep = -1
|
||||
# valgrind makes things so slow
|
||||
dns_timeout = 60
|
||||
dns_attempts = 20
|
||||
query_trusted_key_servers_first = false
|
||||
query_trusted_key_servers_first_on_join = false
|
||||
request_conn_timeout = 60
|
||||
request_timeout = 120
|
||||
well_known_conn_timeout = 60
|
||||
well_known_timeout = 60
|
||||
federation_idle_timeout = 300
|
||||
sender_timeout = 300
|
||||
rocksdb_log_level = "debug"
|
||||
rocksdb_max_log_files = 1
|
||||
rocksdb_paranoid_file_checks = true
|
||||
rocksdb_recovery_mode = 0
|
||||
sender_idle_timeout = 300
|
||||
sender_retry_backoff_limit = 300
|
||||
allow_invalid_tls_certificates = true
|
||||
sender_timeout = 300
|
||||
startup_netburst = true
|
||||
startup_netburst_keep = -1
|
||||
trusted_servers = []
|
||||
url_preview_domain_contains_allowlist = ["*"]
|
||||
url_preview_domain_explicit_denylist = ["*"]
|
||||
well_known_conn_timeout = 60
|
||||
well_known_timeout = 60
|
||||
yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse = true
|
||||
|
||||
[global.tls]
|
||||
certs = "/complement/certificate.crt"
|
||||
@@ -150,7 +151,7 @@ ENTRYPOINT valgrind \
|
||||
FROM input AS complement-base
|
||||
ARG var_cache
|
||||
ARG var_lib_apt
|
||||
ARG complement_tags="tuwunel_blacklist"
|
||||
ARG complement_tags="conduwuit_blacklist"
|
||||
ARG complement_tests="./tests/..."
|
||||
ARG complement_run=".*"
|
||||
|
||||
@@ -211,6 +212,7 @@ ENV COMPLEMENT_HOST_MOUNTS="/var/run/docker.sock:/var/run/docker.sock"
|
||||
ENV jq_res='{Action: .Action, Test: .Test}'
|
||||
ENV jq_sel='select((.Action == \"pass\" or .Action == \"fail\" or .Action == \"skip\") and .Test != null)'
|
||||
ENV jq_tab='[.Action, .Test] | @tsv'
|
||||
ENV jq_out='select(.Test != null) | {Test: .Test, Output: .Output}'
|
||||
COPY --from=complement-config /complement/old_results.jsonl .
|
||||
COPY <<EOF uwu.sh
|
||||
env;
|
||||
@@ -219,22 +221,23 @@ COPY <<EOF uwu.sh
|
||||
COMPLEMENT_BASE_IMAGE="\${1:-$complement_base_image}"
|
||||
go test
|
||||
-json
|
||||
-shuffle="${complement_shuffle}"
|
||||
-parallel="${complement_parallel}"
|
||||
-timeout="${complement_timeout}"
|
||||
-count="${complement_count}"
|
||||
-tags="${complement_tags}"
|
||||
-skip="${complement_skip}"
|
||||
-run="${complement_run}"
|
||||
"${complement_tests}"
|
||||
| jq --unbuffered -c "${jq_sel} | ${jq_res}"
|
||||
"-shuffle=\$complement_shuffle"
|
||||
"-parallel=\$complement_parallel"
|
||||
"-timeout=\$complement_timeout"
|
||||
"-count=\$complement_count"
|
||||
"-tags=\$complement_tags"
|
||||
"-skip=\$complement_skip"
|
||||
"-run=\$complement_run"
|
||||
"\$complement_tests"
|
||||
| jq --unbuffered -c "."
|
||||
| tee output.jsonl
|
||||
| jq --unbuffered -c "$jq_sel | $jq_res"
|
||||
| tee results.jsonl
|
||||
| jq --unbuffered -r "${jq_tab}"
|
||||
| jq --unbuffered -r "$jq_tab"
|
||||
;
|
||||
|
||||
jq -s -c "sort_by(.Test)[]" < results.jsonl | uniq > new_results.jsonl;
|
||||
wc -l old_results.jsonl new_results.jsonl;
|
||||
diff -w -y -t --width=275 --suppress-common-lines old_results.jsonl new_results.jsonl;
|
||||
jq -s -c "sort_by(.Test, .Timestamp)[] | $jq_out" < output.jsonl > full_output.jsonl;
|
||||
EOF
|
||||
RUN echo $(tr -d '\n' < uwu.sh) > uwu.sh
|
||||
RUN echo $(tr -d '\n' < uwu.sh) > uwu.sh && chmod a+x uwu.sh
|
||||
ENTRYPOINT ["/bin/bash", "/usr/src/complement/uwu.sh"]
|
||||
|
||||
@@ -63,15 +63,6 @@ rocksdb_opt_level=3
|
||||
rocksdb_portable=1
|
||||
git_checkout="HEAD"
|
||||
use_chef="true"
|
||||
complement_count=1
|
||||
complement_skip="TestPartialStateJoin.*"
|
||||
complement_skip="${complement_skip}|TestRoomDeleteAlias/Pa.*/Can_delete_canonical_alias"
|
||||
complement_skip="${complement_skip}|TestUnbanViaInvite.*"
|
||||
complement_skip="${complement_skip}|TestToDeviceMessagesOverFederation/stopped_server"
|
||||
complement_skip="${complement_skip}|TestLogin/parallel/POST_/login_as_non-existing_user_is_rejected"
|
||||
complement_skip="${complement_skip}|TestThreadReceiptsInSyncMSC4102"
|
||||
complement_skip="${complement_skip}|TestRoomCreate/Parallel/POST_/createRoom_makes_a_room_with_a_topic_and_writes_rich_topic_representation"
|
||||
complement_skip="${complement_skip}|TestRoomCreate/Parallel/POST_/createRoom_makes_a_room_with_a_topic_via_initial_state_overwritten_by_topic"
|
||||
set +a
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -15,6 +15,19 @@ default_sys_name="debian"
|
||||
default_sys_target="x86_64-v1-linux-gnu"
|
||||
default_sys_version="testing-slim"
|
||||
|
||||
default_run=".*"
|
||||
run="${1:-$default_run}"
|
||||
|
||||
skip=""
|
||||
skip="TestPartialStateJoin.*"
|
||||
skip="${skip}|TestRoomDeleteAlias/Pa.*/Can_delete_canonical_alias"
|
||||
skip="${skip}|TestUnbanViaInvite.*"
|
||||
skip="${skip}|TestToDeviceMessagesOverFederation/stopped_server"
|
||||
skip="${skip}|TestLogin/parallel/POST_/login_as_non-existing_user_is_rejected"
|
||||
skip="${skip}|TestThreadReceiptsInSyncMSC4102"
|
||||
skip="${skip}|TestRoomCreate/Parallel/POST_/createRoom_makes_a_room_with_a_topic_and_writes_rich_topic_representation"
|
||||
skip="${skip}|TestRoomCreate/Parallel/POST_/createRoom_makes_a_room_with_a_topic_via_initial_state_overwritten_by_topic"
|
||||
|
||||
set -a
|
||||
cargo_profile="${cargo_profile:-$default_cargo_profile}"
|
||||
feat_set="${feat_set:-$default_feat_set}"
|
||||
@@ -30,12 +43,21 @@ set +a
|
||||
|
||||
###############################################################################
|
||||
|
||||
envs=""
|
||||
envs="$envs -e complement_verbose=${complement_verbose:-0}"
|
||||
envs="$envs -e complement_count=${complement_count:-1}"
|
||||
envs="$envs -e complement_parallel=${complement_parallel:-16}"
|
||||
envs="$envs -e complement_shuffle=${complement_shuffle:-0}"
|
||||
envs="$envs -e complement_timeout=${complement_timeout:-1h}"
|
||||
envs="$envs -e complement_skip=${complement_skip:-$skip}"
|
||||
envs="$envs -e complement_run=${run}"
|
||||
|
||||
set -x
|
||||
tester_image="complement-tester--${sys_name}--${sys_version}--${sys_target}"
|
||||
testee_image="complement-testee--${cargo_profile}--${rust_toolchain}--${rust_target}--${feat_set}--${sys_name}--${sys_version}--${sys_target}"
|
||||
name="complement_tester__${sys_name}__${sys_version}__${sys_target}"
|
||||
sock="/var/run/docker.sock"
|
||||
arg="--name $name -v $sock:$sock --network=host $tester_image ${testee_image}"
|
||||
arg="--name $name -v $sock:$sock --network=host $envs $tester_image ${testee_image}"
|
||||
set +x
|
||||
|
||||
if test "$CI_VERBOSE_ENV" = "true"; then
|
||||
@@ -45,21 +67,32 @@ fi
|
||||
|
||||
docker rm -f "$name" 2>/dev/null
|
||||
|
||||
trap 'set +x; date; echo -e "\033[1;41;37mERROR\033[0m"' ERR
|
||||
arg="-d $arg"
|
||||
cid=$(docker run $arg)
|
||||
|
||||
if test "$CI" = "true"; then
|
||||
arg="-d $arg"
|
||||
cid=$(docker run $arg)
|
||||
else
|
||||
arg="--rm -a stdout -a stderr $arg"
|
||||
docker run $arg
|
||||
exit $?
|
||||
echo -n "$cid" > "$name"
|
||||
fi
|
||||
|
||||
echo -n "$cid" > "$name"
|
||||
output_src="$cid:/usr/src/complement/full_output.jsonl"
|
||||
output_dst="complement.jsonl"
|
||||
extract_output() {
|
||||
docker cp "$output_src" "$output_dst"
|
||||
}
|
||||
|
||||
trap 'docker container stop $cid; set +x; date; echo -e "\033[1;41;37mERROR\033[0m"' INT
|
||||
result_src="$cid:/usr/src/complement/new_results.jsonl"
|
||||
result_dst="tests/test_results/complement/test_results.jsonl"
|
||||
extract_results() {
|
||||
docker cp "$result_src" "$result_dst"
|
||||
}
|
||||
|
||||
trap 'extract_output; set +x; date; echo -e "\033[1;41;37mERROR\033[0m"' ERR
|
||||
trap 'docker container stop $cid; extract_output' INT
|
||||
docker logs -f "$cid"
|
||||
docker wait "$cid" 2>/dev/null
|
||||
|
||||
extract_results
|
||||
git diff -U0 --color --shortstat "$result_dst" | (grep "$run" || true)
|
||||
|
||||
git diff --quiet --exit-code "$result_dst"
|
||||
echo -e "\033[1;42;30mACCEPT\033[0m"
|
||||
|
||||
@@ -73,7 +73,9 @@ impl ConsoleFormat {
|
||||
#[must_use]
|
||||
pub fn new(config: &Config) -> Self {
|
||||
Self {
|
||||
_compact: fmt::format().compact(),
|
||||
_compact: fmt::format()
|
||||
.compact()
|
||||
.with_ansi(config.log_colors),
|
||||
|
||||
full: Format::<Full>::default()
|
||||
.with_thread_ids(config.log_thread_ids)
|
||||
|
||||
@@ -29,6 +29,8 @@ pub(crate) fn init(
|
||||
.map_err(|e| err!(Config("log", "{e}.")))?;
|
||||
|
||||
let console_layer = fmt::Layer::new()
|
||||
.with_ansi(config.log_colors)
|
||||
.with_thread_ids(config.log_thread_ids)
|
||||
.with_span_events(console_span_events)
|
||||
.event_format(ConsoleFormat::new(config))
|
||||
.fmt_fields(ConsoleFormat::new(config))
|
||||
|
||||
Reference in New Issue
Block a user