Skip to content

fix(ci): rename AISIX_REDIS_URL → CACHE_TEST_REDIS_URL to unblock CI - #39

Closed
moonming wants to merge 1 commit into
mainfrom
fix/ci-redis-env-collision
Closed

fix(ci): rename AISIX_REDIS_URL → CACHE_TEST_REDIS_URL to unblock CI#39
moonming wants to merge 1 commit into
mainfrom
fix/ci-redis-env-collision

Conversation

@moonming

Copy link
Copy Markdown
Member

CI on main has been red since #34 because aisix-core's Config loader merges every AISIX_* env var into the root Config struct (via config-rs Environment::with_prefix("AISIX")), and Config has #[serde(deny_unknown_fields)].

The redis integration test sets AISIX_REDIS_URL on the rust-unit job, which leaks into every Config::load_from_path call as a stray redis_url field and panics:

Config("deserialize: unknown field \`redis_url\`, expected one of \`etcd\`, \`proxy\`, \`admin\`, \`observability\`, \`cache\`, \`managed\`")

8 / 9 aisix-core::config::tests fail (the one that passes is rejects_unknown_fields — it swallows the error intentionally).

Fix

Rename the env var so it doesn't sit under the AISIX_ prefix at all:

  • crates/aisix-cache/tests/redis_integration.rs reads CACHE_TEST_REDIS_URL
  • .github/workflows/ci.yml sets CACHE_TEST_REDIS_URL
  • crates/aisix-cache/src/redis.rs doc comment + docs/testing.md updated to match

Test plan

  • cargo test -p aisix-core --lib config::tests — all 9 pass with the rename
  • Repro the original failure: AISIX_REDIS_URL=… cargo test … loads_minimal_config still fails (so the loader behaviour for real AISIX_* overrides is unchanged)
  • CI green on this PR

🤖 Generated with Claude Code

…t tests

CI on main has been red since #34 because aisix-core's Config crate
loader merges every AISIX_-prefixed env var into the root Config
struct (config-rs Environment::with_prefix("AISIX")), and Config has
#[serde(deny_unknown_fields)]. The redis integration test sets
AISIX_REDIS_URL on the rust-unit job, which leaks into every
Config::load_from_path call as `redis_url` and panics:

    Config("deserialize: unknown field `redis_url`,
           expected one of `etcd`, `proxy`, `admin`,
           `observability`, `cache`, `managed`")

8 of 9 aisix-core::config::tests fail (the one that doesn't is
rejects_unknown_fields, which intentionally swallows the error).

Rename the env var so it doesn't sit under the AISIX_ prefix at
all. crates/aisix-cache/tests/redis_integration.rs reads
CACHE_TEST_REDIS_URL; CI sets the same. docs/testing.md +
crates/aisix-cache/src/redis.rs comment updated to match.

Verified: with the rename, all 9 config tests pass even with
CACHE_TEST_REDIS_URL set; reproducing with the old AISIX_REDIS_URL
still fails as expected (so the loader behaviour is unchanged for
real AISIX_-prefixed env overrides).
Copilot AI review requested due to automatic review settings April 25, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Renames the Redis integration-test environment variable to avoid AISIX_* leaking into aisix-core config loading (which denies unknown fields), unblocking CI.

Changes:

  • Switched Redis integration tests to read CACHE_TEST_REDIS_URL instead of AISIX_REDIS_URL.
  • Updated GitHub Actions rust-unit job to set CACHE_TEST_REDIS_URL (and documented why it must not use the AISIX_ prefix).
  • Updated testing docs and in-crate documentation to match the new env var name.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
docs/testing.md Updates integration-test and CI documentation to reference CACHE_TEST_REDIS_URL.
crates/aisix-cache/tests/redis_integration.rs Reads CACHE_TEST_REDIS_URL and updates skip messages accordingly.
crates/aisix-cache/src/redis.rs Updates doc comment pointing to the opt-in integration env var.
.github/workflows/ci.yml Sets CACHE_TEST_REDIS_URL for the rust-unit job and documents the config-loader interaction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@moonming

Copy link
Copy Markdown
Member Author

✅ Rust tests all pass with the rename — confirmed via the CI log:

```
test result: ok. 70 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
test result: ok. 102 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
... (every aisix-* crate green)
```

The job is showing as failed because of:

```
##[error]Failed to CreateArtifact: Artifact storage quota has been hit.
```

That's an org-level Actions storage quota issue (independent of this PR — `actions/upload-artifact@v4` rejects regardless of test outcome). Either free up artifacts or upgrade the plan to make CI pass cleanly. The fix itself is verified end-to-end.

🤖 Generated with Claude Code

@moonming

Copy link
Copy Markdown
Member Author

Superseded by #40, which combines this PR's workflow rename with the supervisor cache-write fix and the artifact-quota mitigation. Merged as 6bf6227.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants