Skip to content

Commit e7f2b8e

Browse files
committed
test: workaround the failed error
Add workaround to fix error ``` content: error: Installing to filesystem: Gathering source info from container env: Subprocess failed: ExitStatus(unix_wait_status(256)) content: error: readdir: Too many open files ``` Signed-off-by: Huijing Hei <hhei@redhat.com>
1 parent e6bc78f commit e7f2b8e

File tree

5 files changed

+38
-16
lines changed

5 files changed

+38
-16
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,15 @@ jobs:
205205
else
206206
just test-tmt integration
207207
fi
208+
just clean-local-images
209+
208210
- name: Run TMT test about bootc install on coreos
209211
run: |
210212
# Only test fedora-43 on fedora-coreos:testing-devel
211213
if [ "${{ matrix.test_os }}" = "fedora-43" ] && [ "${{ matrix.variant }}" = "ostree" ]; then
214+
just build-testimage-coreos target/packages
212215
just test-tmt-on-coreos plan-bootc-install-on-coreos
216+
just clean-local-images
213217
else
214218
echo "skipped"
215219
fi

Justfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,16 @@ _build-upgrade-image:
164164
test-tmt-nobuild *ARGS:
165165
cargo xtask run-tmt --env=BOOTC_variant={{variant}} --upgrade-image={{integration_upgrade_img}} {{integration_img}} {{ARGS}}
166166

167-
# Test bootc install on coreos (FCOS)
168-
# Assume the localhost/bootc-integration image is up to date, and just run tests.
169-
# BOOTC_target is the bootc-integration, that will be used for bootc install
167+
# Build test container image for testing on coreos
168+
# without configs and no curl container image
169+
build-testimage-coreos PATH:
170+
@just build-from-package {{PATH}}
171+
cd hack && podman build {{base_buildargs}} --build-arg SKIP_CONFIGS=1 -t {{integration_img}}-coreos -f Containerfile .
172+
173+
# Just run test bootc install on coreos (FCOS)
174+
# BOOTC_target is the bootc-integration-coreos, that will be used for bootc install
170175
test-tmt-on-coreos *ARGS:
171-
@if ! podman image exists {{integration_img}}; then just build-integration-test-image; fi
172-
cargo xtask run-tmt --env=BOOTC_variant={{variant}} --env=BOOTC_target={{integration_img}}:latest {{fedora-coreos}} {{ARGS}}
176+
cargo xtask run-tmt --env=BOOTC_variant={{variant}} --env=BOOTC_target={{integration_img}}-coreos:latest {{fedora-coreos}} {{ARGS}}
173177

174178
# Cleanup all test VMs created by tmt tests
175179
tmt-vm-cleanup:
@@ -185,6 +189,7 @@ test-container: build-units build-integration-test-image
185189
clean-local-images:
186190
podman images --filter "label={{testimage_label}}"
187191
podman images --filter "label={{testimage_label}}" --format "{{{{.ID}}" | xargs -r podman rmi -f
192+
podman image prune -f
188193
podman rmi {{fedora-coreos}} -f
189194

190195
# Print the container image reference for a given short $ID-VERSION_ID for NAME

crates/xtask/src/tmt.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,14 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
321321
.run()
322322
.with_context(|| format!("Copying tmt files to {}", workdir))?;
323323

324+
// Workaround for https://github.com/bootc-dev/bcvk/issues/174
325+
// Save the container image to tar, this will be synced to tested OS
326+
if variant_id == "coreos" {
327+
cmd!(sh, "podman save -q -o {workdir}/tmt/tests/bootc.tar localhost/bootc-integration-coreos:latest")
328+
.run()
329+
.with_context(|| format!("Saving container image to tar"))?;
330+
}
331+
324332
// Change to workdir for running tmt commands
325333
let _dir = sh.push_dir(workdir);
326334

@@ -414,14 +422,10 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
414422
);
415423
}
416424
// Add --filesystem=xfs by default on fedora-coreos
417-
// Add --bind-storage-ro if supported
418425
if variant_id == "coreos" {
419426
if distro.starts_with("fedora") {
420427
opts.push("--filesystem=xfs".to_string());
421428
}
422-
if supports_bind_storage_ro {
423-
opts.push(BCVK_OPT_BIND_STORAGE_RO.to_string());
424-
}
425429
}
426430
opts
427431
};
@@ -441,7 +445,6 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
441445
test_results.push((plan.to_string(), false, None));
442446
continue;
443447
}
444-
445448
// Ensure VM cleanup happens even on error (unless --preserve-vm is set)
446449
let cleanup_vm = || {
447450
if preserve_vm {

hack/Containerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ EORUN
1818

1919
# And the configs
2020
FROM extended
21+
ARG SKIP_CONFIGS
2122
RUN --mount=type=bind,from=context,target=/run/context <<EORUN
23+
# Do not need the configs when testing installation on ostree
24+
echo "SKIP_CONFIGS=${SKIP_CONFIGS:-<unset>}"
25+
if [ -n "${SKIP_CONFIGS:-}" ]; then
26+
echo "Skipping configs installation"
27+
exit 0
28+
fi
2229
set -xeuo pipefail
2330
cd /run/context
2431
# For test-22-logically-bound-install

tmt/tests/examples/test-on-ostree/test-install-on-ostree.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@ if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then
2626
echo "Should be ostree OS"
2727
exit 1
2828
fi
29-
podman image exists ${BOOTC_target}
29+
# workaround for https://github.com/bootc-dev/bcvk/issues/174
30+
bootc_tar=bootc.tar
31+
[ -f ${bootc_tar} ]
32+
podman load -q -i ${bootc_tar}
33+
podman image exists ${BOOTC_target} && rm -f ${bootc_tar}
34+
3035
# Run bootc install using the same stateroot for shared /var
3136
stateroot=$(bootc status --json | jq -r .status.booted.ostree.stateroot)
32-
33-
# Need bind mount for /run/host-container-storage
34-
podman run --rm --privileged \
37+
podman run \
38+
--rm --privileged \
3539
-v /dev:/dev \
36-
-v /run/host-container-storage:/run/host-container-storage:ro \
3740
-v /:/target \
41+
-v /var/lib/containers:/var/lib/containers \
3842
--pid=host \
3943
--security-opt label=type:unconfined_t \
4044
${BOOTC_target} \
41-
env BOOTC_BOOTLOADER_DEBUG=1 STORAGE_OPTS=additionalimagestore=/run/host-container-storage \
4245
bootc install to-existing-root \
4346
--stateroot=${stateroot} \
4447
--skip-fetch-check \

0 commit comments

Comments
 (0)