mirror of
https://github.com/marcoallegretti/karapace.git
synced 2026-03-27 05:53:10 +00:00
fix CI: fmt, skip migrate readonly test as root, fix container shell
- Run cargo fmt on skip_if_root() blocks - Add skip_if_root() to migrate_atomic_version_unchanged_on_write_failure - Add libc dev-dependency to karapace-store for root check - Remove explicit shell: sh from container rustup steps (OCI exec can't find sh in PATH; default run shell works)
This commit is contained in:
parent
cc67d70211
commit
37211dfd22
5 changed files with 38 additions and 12 deletions
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
|
@ -67,9 +67,9 @@ jobs:
|
||||||
run: zypper install -y gcc make curl gzip tar xz
|
run: zypper install -y gcc make curl gzip tar xz
|
||||||
- name: Install Rust (container)
|
- name: Install Rust (container)
|
||||||
if: matrix.container != ''
|
if: matrix.container != ''
|
||||||
shell: sh
|
|
||||||
run: |
|
run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $RUST_TOOLCHAIN --profile minimal
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_TOOLCHAIN }} --profile minimal
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
if: matrix.container == ''
|
if: matrix.container == ''
|
||||||
|
|
@ -150,9 +150,9 @@ jobs:
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
run: ${{ matrix.setup }}
|
run: ${{ matrix.setup }}
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
shell: sh
|
|
||||||
run: |
|
run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $RUST_TOOLCHAIN --profile minimal
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_TOOLCHAIN }} --profile minimal
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- name: Enable user namespaces
|
- name: Enable user namespaces
|
||||||
|
|
|
||||||
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1198,6 +1198,7 @@ dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"fs2",
|
"fs2",
|
||||||
"karapace-schema",
|
"karapace-schema",
|
||||||
|
"libc",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tar",
|
"tar",
|
||||||
|
|
|
||||||
|
|
@ -1379,7 +1379,9 @@ fn gc_is_idempotent_after_partial_run() {
|
||||||
// M6.2: Object read fails gracefully on permission denied
|
// M6.2: Object read fails gracefully on permission denied
|
||||||
#[test]
|
#[test]
|
||||||
fn object_get_fails_on_permission_denied() {
|
fn object_get_fails_on_permission_denied() {
|
||||||
if skip_if_root() { return; }
|
if skip_if_root() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let store = tempfile::tempdir().unwrap();
|
let store = tempfile::tempdir().unwrap();
|
||||||
let layout = StoreLayout::new(store.path());
|
let layout = StoreLayout::new(store.path());
|
||||||
layout.initialize().unwrap();
|
layout.initialize().unwrap();
|
||||||
|
|
@ -1401,7 +1403,9 @@ fn object_get_fails_on_permission_denied() {
|
||||||
// M6.2: Metadata write fails gracefully on read-only store
|
// M6.2: Metadata write fails gracefully on read-only store
|
||||||
#[test]
|
#[test]
|
||||||
fn metadata_put_fails_on_read_only_dir() {
|
fn metadata_put_fails_on_read_only_dir() {
|
||||||
if skip_if_root() { return; }
|
if skip_if_root() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let store = tempfile::tempdir().unwrap();
|
let store = tempfile::tempdir().unwrap();
|
||||||
let layout = StoreLayout::new(store.path());
|
let layout = StoreLayout::new(store.path());
|
||||||
layout.initialize().unwrap();
|
layout.initialize().unwrap();
|
||||||
|
|
@ -1605,7 +1609,9 @@ fn stale_running_marker_cleaned_on_engine_new() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn build_on_readonly_objects_dir_returns_error() {
|
fn build_on_readonly_objects_dir_returns_error() {
|
||||||
if skip_if_root() { return; }
|
if skip_if_root() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let store = tempfile::tempdir().unwrap();
|
let store = tempfile::tempdir().unwrap();
|
||||||
let project = tempfile::tempdir().unwrap();
|
let project = tempfile::tempdir().unwrap();
|
||||||
|
|
||||||
|
|
@ -1630,7 +1636,9 @@ fn build_on_readonly_objects_dir_returns_error() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn build_on_readonly_metadata_dir_returns_error() {
|
fn build_on_readonly_metadata_dir_returns_error() {
|
||||||
if skip_if_root() { return; }
|
if skip_if_root() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let store = tempfile::tempdir().unwrap();
|
let store = tempfile::tempdir().unwrap();
|
||||||
let project = tempfile::tempdir().unwrap();
|
let project = tempfile::tempdir().unwrap();
|
||||||
|
|
||||||
|
|
@ -1653,7 +1661,9 @@ fn build_on_readonly_metadata_dir_returns_error() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn commit_on_readonly_layers_dir_returns_error() {
|
fn commit_on_readonly_layers_dir_returns_error() {
|
||||||
if skip_if_root() { return; }
|
if skip_if_root() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let store = tempfile::tempdir().unwrap();
|
let store = tempfile::tempdir().unwrap();
|
||||||
let project = tempfile::tempdir().unwrap();
|
let project = tempfile::tempdir().unwrap();
|
||||||
let engine = Engine::new(store.path());
|
let engine = Engine::new(store.path());
|
||||||
|
|
@ -1692,7 +1702,9 @@ fn commit_on_readonly_layers_dir_returns_error() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn write_failure_never_panics() {
|
fn write_failure_never_panics() {
|
||||||
if skip_if_root() { return; }
|
if skip_if_root() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let store = tempfile::tempdir().unwrap();
|
let store = tempfile::tempdir().unwrap();
|
||||||
let layout = StoreLayout::new(store.path());
|
let layout = StoreLayout::new(store.path());
|
||||||
layout.initialize().unwrap();
|
layout.initialize().unwrap();
|
||||||
|
|
@ -2114,7 +2126,9 @@ backend = "mock"
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn wal_write_fails_on_readonly_dir() {
|
fn wal_write_fails_on_readonly_dir() {
|
||||||
if skip_if_root() { return; }
|
if skip_if_root() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let store = tempfile::tempdir().unwrap();
|
let store = tempfile::tempdir().unwrap();
|
||||||
let layout = StoreLayout::new(store.path());
|
let layout = StoreLayout::new(store.path());
|
||||||
layout.initialize().unwrap();
|
layout.initialize().unwrap();
|
||||||
|
|
@ -2138,7 +2152,9 @@ fn wal_write_fails_on_readonly_dir() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn build_fails_cleanly_when_wal_dir_is_readonly() {
|
fn build_fails_cleanly_when_wal_dir_is_readonly() {
|
||||||
if skip_if_root() { return; }
|
if skip_if_root() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let store = tempfile::tempdir().unwrap();
|
let store = tempfile::tempdir().unwrap();
|
||||||
let project = tempfile::tempdir().unwrap();
|
let project = tempfile::tempdir().unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,3 +20,6 @@ chrono.workspace = true
|
||||||
tar.workspace = true
|
tar.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
karapace-schema = { path = "../karapace-schema" }
|
karapace-schema = { path = "../karapace-schema" }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
libc.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,12 @@ fn migrate_rejects_future_version() {
|
||||||
fn migrate_atomic_version_unchanged_on_write_failure() {
|
fn migrate_atomic_version_unchanged_on_write_failure() {
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
|
||||||
|
// Root bypasses filesystem permission checks — skip in containers
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
if unsafe { libc::getuid() } == 0 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
create_v1_store(dir.path(), 1);
|
create_v1_store(dir.path(), 1);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue