Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ jobs:
run: |
# Run Docker-based integration tests
# Use --ignored to run tests marked with #[ignore]
# Use --test-threads=1 to avoid race conditions in concurrent test execution
# Ensure tests run and fail if they fail (don't skip)
cargo test --test docker_integration_test --features integration-test --no-default-features -- --ignored --nocapture
cargo test --test docker_integration_test --features integration-test --no-default-features -- --ignored --nocapture --test-threads=1

build:
name: Build
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ jobs:
fi
echo "NGINX_SOURCE_DIR=/tmp/nginx-$NGX_VERSION" >> $GITHUB_ENV

- name: Update Debian changelog version
run: |
VERSION=$(grep '^version' Cargo.toml | cut -d'"' -f2)
echo "Detected version from Cargo.toml: $VERSION"
# Update debian/changelog version to match Cargo.toml
# Format: nginx-x402 (VERSION-1) unstable; urgency=medium
sed -i "1s/(.*)/(${VERSION}-1)/" debian/changelog

- name: Build Debian package
env:
NGINX_SOURCE_DIR: ${{ env.NGINX_SOURCE_DIR }}
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nginx-x402"
version = "1.3.0"
version = "1.3.1"
edition = "2021"
description = "Pure Rust Nginx module for x402 HTTP micropayment protocol"
authors = ["Ryan Kung <ryan@polyjuice.io>"]
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
nginx-x402 (1.3.1-1) unstable; urgency=medium

* Version bump to 1.3.1
* Add retry logic to integration tests for better stability
* Configure CI to use single-threaded test execution
* Fix race conditions in concurrent test execution

nginx-x402 (1.3.0-1) unstable; urgency=medium

* Version bump to 1.3.0
Expand Down
8 changes: 7 additions & 1 deletion rpm/nginx-x402.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%define moduledir %{_libdir}/nginx/modules

Name: nginx-x402
Version: 1.3.0
Version: 1.3.1
Release: 1%{?dist}
Summary: Pure Rust Nginx module for x402 HTTP micropayment protocol
License: AGPL-3.0
Expand Down Expand Up @@ -673,6 +673,12 @@ fi
%{_datadir}/%{name}/

%changelog
* Mon Dec 01 2025 Ryan Kung <ryan@polyjuice.io> - 1.3.1-1
- Version bump to 1.3.1
- Add retry logic to integration tests for better stability
- Configure CI to use single-threaded test execution
- Fix race conditions in concurrent test execution

* Thu Dec 26 2025 Ryan Kung <ryan@polyjuice.io> - 1.3.0-1
- Version bump to 1.3.0
- Add automatic full URL building for x402_resource
Expand Down
4 changes: 4 additions & 0 deletions tests/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RUN apt-get update && apt-get install -y \
zlib1g-dev \
wget \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

# Install Rust toolchain (cached separately from system packages)
Expand Down Expand Up @@ -100,6 +101,9 @@ COPY tests/nginx.test.conf /etc/nginx/nginx.conf
# Create test directories
RUN mkdir -p /var/www/html /var/log/nginx

# Install Flask for mock backend
RUN pip3 install --no-cache-dir flask

# Copy mock backend server script
COPY tests/mock-backend.py /usr/local/bin/mock-backend.py
RUN chmod +x /usr/local/bin/mock-backend.py
Expand Down
22 changes: 21 additions & 1 deletion tests/docker_integration/basic_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,27 @@ mod tests {
return;
}

let status = http_request("/api/protected").expect("Failed to make HTTP request");
// Retry logic: sometimes nginx needs a moment to be fully ready, especially under concurrent test execution
let mut status = String::new();
let mut retries = 5;
while retries > 0 {
match http_request("/api/protected") {
Some(s) if s != "000" => {
status = s;
break;
}
Some(s) => {
status = s;
retries -= 1;
thread::sleep(Duration::from_millis(500));
}
None => {
status = "000".to_string();
retries -= 1;
thread::sleep(Duration::from_millis(500));
}
}
}

assert_eq!(status, "402", "Expected 402 response, got {status}");
}
Expand Down
Loading