Skip to content

Commit b591749

Browse files
author
mayastor-bors
committed
Try #1793:
2 parents 687da6c + 82dc1bb commit b591749

33 files changed

+362
-102
lines changed

.github/workflows/bdd.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: BDD CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
9+
jobs:
10+
bdd-tests:
11+
runs-on: ubuntu-latest-16-cores
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
submodules: 'recursive'
17+
- uses: DeterminateSystems/nix-installer-action@v14
18+
- uses: DeterminateSystems/magic-nix-cache-action@v8
19+
- name: Pre-populate nix-shell
20+
run: |
21+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
22+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
23+
nix-shell --run "echo" shell.nix
24+
- name: Handle Rust dependencies caching
25+
uses: Swatinem/rust-cache@v2
26+
- name: Build binaries
27+
run: nix-shell --run "cargo build --bins --features=io-engine-testing"
28+
- name: Setup Test Pre-Requisites
29+
run: |
30+
sudo sysctl -w vm.nr_hugepages=2560
31+
sudo apt-get install linux-modules-extra-$(uname -r)
32+
for module in nvme_tcp nbd nvme_rdma; do
33+
sudo modprobe $module
34+
done
35+
# for the coredump check
36+
sudo apt-get install gdb
37+
- name: Setup VENV
38+
run: nix-shell --run "./test/python/setup.sh"
39+
- name: Run BDD Tests
40+
run: |
41+
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
42+
nix-shell --run "./scripts/pytest-tests.sh"
43+
- name: Test Report
44+
if: always()
45+
uses: pmeier/pytest-results-action@main
46+
with:
47+
path: test/python/reports/**/xunit-report.xml
48+
summary: true
49+
display-options: a
50+
fail-on-empty: true
51+
title: Test results
52+
- name: Cleanup
53+
if: always()
54+
run: nix-shell --run "./scripts/pytest-tests.sh --clean-all-exit"
55+
- name: Check Coredumps
56+
run: sudo ./scripts/check-coredumps.sh --since "${TEST_START_DATE}"
57+
# debugging
58+
# - name: Setup tmate session
59+
# if: ${{ failure() }}
60+
# timeout-minutes: 240
61+
# uses: mxschmitt/action-tmate@v3

.github/workflows/image-pr.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: ImageBuild CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
9+
jobs:
10+
image-build-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: 'recursive'
16+
- uses: DeterminateSystems/nix-installer-action@v14
17+
- uses: DeterminateSystems/magic-nix-cache-action@v8
18+
- name: Test building the release images
19+
run: ./scripts/release.sh --skip-publish --build-bins

.github/workflows/image.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Image Push
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
- 'release/**'
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+**'
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
CARGO_INCREMENTAL: 0
13+
14+
jobs:
15+
image-build-test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: 'recursive'
21+
- uses: DeterminateSystems/nix-installer-action@v14
22+
- uses: DeterminateSystems/magic-nix-cache-action@v8
23+
- name: Login to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ vars.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_TOKEN }}
28+
- name: Test building the release images
29+
run: ./scripts/release.sh

.github/workflows/lint.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Unit/Int CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
9+
jobs:
10+
code-linter:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: 'recursive'
16+
- uses: DeterminateSystems/nix-installer-action@v14
17+
- uses: DeterminateSystems/magic-nix-cache-action@v8
18+
- name: Pre-populate nix-shell
19+
run: |
20+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
21+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
22+
nix-shell --run "echo" shell.nix
23+
- name: Handle Rust dependencies caching
24+
uses: Swatinem/rust-cache@v2
25+
- name: Lint rust code
26+
run: |
27+
nix-shell --run "FMT_OPTS=--check ./scripts/rust-style.sh"
28+
nix-shell --run "./scripts/rust-linter.sh"
29+
- name: Lint JS code
30+
run: nix-shell --run "./scripts/js-check.sh"
31+
- name: Lint Nix code
32+
run: nix-shell --run "nixpkgs-fmt --check ."

.github/workflows/nightly-ci.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Nightly CI
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
ci:
7+
uses: ./.github/workflows/pr-ci.yml
8+
nightly-ci:
9+
if: ${{ success() }}
10+
needs:
11+
- ci
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: CI succeeded
15+
run: exit 0

.github/workflows/pr-ci.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Bors CI
2+
on:
3+
push:
4+
branches:
5+
- staging
6+
- trying
7+
8+
jobs:
9+
lint-ci:
10+
uses: ./.github/workflows/lint.yml
11+
int-ci:
12+
uses: ./.github/workflows/unit-int.yml
13+
bdd-ci:
14+
uses: ./.github/workflows/bdd.yml
15+
image-ci:
16+
uses: ./.github/workflows/image-pr.yml
17+
bors-ci:
18+
if: ${{ success() }}
19+
needs:
20+
- lint-ci
21+
- int-ci
22+
- bdd-ci
23+
- image-ci
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: CI succeeded
27+
run: exit 0

.github/workflows/unit-int.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Integration CI
2+
on:
3+
workflow_call:
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
CARGO_INCREMENTAL: 0
8+
9+
jobs:
10+
int-tests:
11+
runs-on: ubuntu-latest-16-cores
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
submodules: 'recursive'
17+
- uses: DeterminateSystems/nix-installer-action@v14
18+
- uses: DeterminateSystems/magic-nix-cache-action@v8
19+
- name: Pre-populate nix-shell
20+
run: |
21+
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
22+
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
23+
nix-shell --run "echo" shell.nix
24+
- name: Handle Rust dependencies caching
25+
uses: Swatinem/rust-cache@v2
26+
with:
27+
save-if: ${{ startsWith(github.ref_name, 'release/') || github.ref_name == 'develop' }}
28+
- name: Build binaries
29+
run: nix-shell --run "cargo build --bins --features=io-engine-testing"
30+
- name: Setup Test Pre-Requisites
31+
run: |
32+
sudo sysctl -w vm.nr_hugepages=3584
33+
sudo apt-get install linux-modules-extra-$(uname -r)
34+
for module in nvme_tcp nbd nvme_rdma; do
35+
sudo modprobe $module
36+
done
37+
sudo apt-get install gdb
38+
- name: Run Rust Tests
39+
run: |
40+
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
41+
nix-shell --run "./scripts/cargo-test.sh"
42+
- name: Cleanup
43+
if: always()
44+
run: nix-shell --run "./scripts/clean-cargo-tests.sh"
45+
- name: Check Coredumps
46+
run: sudo ./scripts/check-coredumps.sh --since "${TEST_START_DATE}"
47+
- name: Run JS Grpc Tests
48+
run: |
49+
echo "TEST_START_DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
50+
nix-shell --run "./scripts/grpc-test.sh"
51+
mkdir js-reports
52+
for file in *-xunit-report.xml; do
53+
echo "<testsuites>" > "js-reports/$file"
54+
cat $file >> "js-reports/$file"
55+
echo "</testsuites>" >> "js-reports/$file"
56+
done
57+
- name: Test Report
58+
if: always()
59+
uses: pmeier/pytest-results-action@main
60+
with:
61+
path: 'js-reports/*-xunit-report.xml'
62+
summary: true
63+
display-options: a
64+
fail-on-empty: true
65+
title: Test results
66+
- name: Cleanup
67+
if: always()
68+
run: nix-shell --run "./scripts/clean-cargo-tests.sh"
69+
- name: Check Coredumps
70+
run: sudo ./scripts/check-coredumps.sh --since "${TEST_START_DATE}"
71+
# debugging
72+
# - name: Setup tmate session
73+
# if: ${{ failure() }}
74+
# timeout-minutes: 240
75+
# uses: mxschmitt/action-tmate@v3

io-engine-tests/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ pub fn mount_and_get_md5(device: &str) -> Result<String, String> {
342342
pub fn fio_run_verify(device: &str) -> Result<String, String> {
343343
let (exit, stdout, stderr) = run_script::run(
344344
r"
345-
fio --name=randrw --rw=randrw --ioengine=libaio --direct=1 --time_based=1 \
345+
$FIO --name=randrw --rw=randrw --ioengine=libaio --direct=1 --time_based=1 \
346346
--runtime=5 --bs=4k --verify=crc32 --group_reporting=1 --output-format=terse \
347347
--verify_fatal=1 --verify_async=2 --filename=$1
348348
",
@@ -511,11 +511,11 @@ pub async fn wait_for_rebuild(dst_uri: String, state: RebuildState, timeout: Dur
511511
pub fn fio_verify_size(device: &str, size: u64) -> i32 {
512512
let (exit, stdout, stderr) = run_script::run(
513513
r"
514-
fio --thread=1 --numjobs=1 --iodepth=16 --bs=512 \
514+
$FIO --thread=1 --numjobs=1 --iodepth=16 --bs=512 \
515515
--direct=1 --ioengine=libaio --rw=randwrite --verify=crc32 \
516516
--verify_fatal=1 --name=write_verify --filename=$1 --size=$2
517517
518-
fio --thread=1 --numjobs=1 --iodepth=16 --bs=512 \
518+
$FIO --thread=1 --numjobs=1 --iodepth=16 --bs=512 \
519519
--direct=1 --ioengine=libaio --verify=crc32 --verify_only \
520520
--verify_fatal=1 --name=verify --filename=$1
521521
",

io-engine/.cargo/runner.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ARGS="${@}"
55

66
if [[ $EUID -ne 0 ]]; then
7-
MAYBE_SUDO='sudo -E'
7+
MAYBE_SUDO='sudo -E --preserve-env=PATH'
88
else
99
MAYBE_SUDO=''
1010
fi

io-engine/tests/ftl_mount_fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async fn ftl_mount_fs_multiple() {
9797
pub fn csal_fio_run_verify(device: &str) -> Result<String, String> {
9898
let (exit, stdout, stderr) = run_script::run(
9999
r#"
100-
fio --name=randrw --rw=randrw --ioengine=libaio --direct=1 --time_based=1 \
100+
$FIO --name=randrw --rw=randrw --ioengine=libaio --direct=1 --time_based=1 \
101101
--runtime=10 --bs=64k --verify=crc32 --group_reporting=1 \
102102
--verify_fatal=1 --verify_async=2 --filename=$1
103103
"#,

libnvme-rs/src/nvme_uri.rs

+6
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,12 @@ impl NvmeTarget {
347347
}
348348
}
349349

350+
impl Drop for NvmeTarget {
351+
fn drop(&mut self) {
352+
self.disconnect().ok();
353+
}
354+
}
355+
350356
#[test]
351357
fn nvme_parse_uri() {
352358
let target = NvmeTarget::try_from("nvmf://1.2.3.4:1234/testnqn.what-ever.foo").unwrap();

scripts/grpc-test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ set -euxo pipefail
1616
export PATH="$PATH:${HOME}/.cargo/bin"
1717
export npm_config_jobs=$(nproc)
1818

19-
cargo build --all
19+
cargo build --bins --features=io-engine-testing
2020
cd "$(dirname "$0")/../test/grpc"
2121
npm install --legacy-peer-deps
2222

scripts/nvmx-test.sh

-4
This file was deleted.

test/python/cross-grpc-version/nexus/docker-compose.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ services:
88
container_name: "ms0"
99
image: rust:latest
1010
environment:
11-
- MY_POD_IP=10.0.0.2
11+
- MY_POD_IP=10.1.0.2
1212
- NEXUS_NVMF_ANA_ENABLE=1
1313
- NEXUS_NVMF_RESV_ENABLE=1
1414
- PATH=${LLVM_SYMBOLIZER_DIR:-}
1515
- ASAN_OPTIONS=detect_leaks=0
1616
command: ${SRCDIR}/${IO_ENGINE_DIR}/io-engine -g 0.0.0.0 -l 1,2 -r /tmp/ms0.sock
1717
networks:
1818
mayastor_net:
19-
ipv4_address: 10.0.0.2
19+
ipv4_address: 10.1.0.2
2020
cap_add:
2121
# NUMA related
2222
- SYS_ADMIN
@@ -36,15 +36,15 @@ services:
3636
container_name: "ms1"
3737
image: rust:latest
3838
environment:
39-
- MY_POD_IP=10.0.0.3
39+
- MY_POD_IP=10.1.0.3
4040
- NEXUS_NVMF_ANA_ENABLE=1
4141
- NEXUS_NVMF_RESV_ENABLE=1
4242
- PATH=${LLVM_SYMBOLIZER_DIR:-}
4343
- ASAN_OPTIONS=detect_leaks=0
4444
command: ${SRCDIR}/${IO_ENGINE_DIR}/io-engine -g 0.0.0.0 -l 3,4 -r /tmp/ms1.sock
4545
networks:
4646
mayastor_net:
47-
ipv4_address: 10.0.0.3
47+
ipv4_address: 10.1.0.3
4848
cap_add:
4949
# NUMA related
5050
- SYS_ADMIN
@@ -66,4 +66,4 @@ networks:
6666
ipam:
6767
driver: default
6868
config:
69-
- subnet: "10.0.0.0/16"
69+
- subnet: "10.1.0.0/16"

test/python/cross-grpc-version/pool/docker-compose.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ services:
88
container_name: "ms0"
99
image: rust:latest
1010
environment:
11-
- MY_POD_IP=10.0.0.2
11+
- MY_POD_IP=10.1.0.2
1212
- NEXUS_NVMF_ANA_ENABLE=1
1313
- NEXUS_NVMF_RESV_ENABLE=1
1414
- PATH=${LLVM_SYMBOLIZER_DIR:-}
1515
- ASAN_OPTIONS=detect_leaks=0
1616
command: ${SRCDIR}/${IO_ENGINE_DIR}/io-engine -g 0.0.0.0 -l 1,2 -r /tmp/ms0.sock --env-context=--iova-mode=pa
1717
networks:
1818
mayastor_net:
19-
ipv4_address: 10.0.0.2
19+
ipv4_address: 10.1.0.2
2020
cap_add:
2121
# NUMA related
2222
- SYS_ADMIN
@@ -38,4 +38,4 @@ networks:
3838
ipam:
3939
driver: default
4040
config:
41-
- subnet: "10.0.0.0/16"
41+
- subnet: "10.1.0.0/16"

0 commit comments

Comments
 (0)