From a1d51c0b6a6eb0415ec98d88b14dfe41ed475e28 Mon Sep 17 00:00:00 2001 From: Yuki Tanaka Date: Sun, 20 Oct 2024 23:13:27 +0900 Subject: [PATCH] ci: use Redis v7.4 (#451) --- .github/workflows/build.yml | 6 ++++-- deno.json | 2 +- tests/commands/acl.ts | 35 +++++++++++++---------------------- tests/commands/string.ts | 5 ++++- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4662667b..9f693526 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - redis: [6.2] + redis: [6.2, 7.4] timeout-minutes: 15 steps: - uses: actions/checkout@v2 @@ -53,6 +53,8 @@ jobs: - name: Run tests run: | deno task test + env: + REDIS_VERSION: ${{ matrix.redis }} - name: Run doc tests run: | deno task test:doc @@ -65,7 +67,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - redis: [6.2] + redis: [7.4] timeout-minutes: 15 steps: - uses: actions/checkout@v2 diff --git a/deno.json b/deno.json index 428ae2c8..46a13329 100644 --- a/deno.json +++ b/deno.json @@ -16,7 +16,7 @@ "tasks": { "lock": "rm deno.lock && DENO_FUTURE=1 deno cache --reload mod.ts experimental/**/mod.ts tests/**/*.ts", "check:deno-json": "deno run --allow-read=deno.json tools/check_deno_json.js", - "test": "DENO_FUTURE=1 deno test --allow-net --allow-read=tests --allow-write=tests/tmp --allow-run=redis-server,redis-cli --coverage=coverage --trace-leaks --frozen-lockfile", + "test": "DENO_FUTURE=1 deno test --allow-net --allow-read=tests --allow-write=tests/tmp --allow-run=redis-server,redis-cli --allow-env=REDIS_VERSION --coverage=coverage --trace-leaks --frozen-lockfile", "test:doc": "deno check --doc-only --import-map=import_map.test.json README.md experimental/cluster/README.md", "coverage": "deno coverage ./coverage --lcov --output=coverage/lcov.info", "make_mod": "deno run --allow-read --allow-write --allow-run=deno --check tools/make_mod.ts", diff --git a/tests/commands/acl.ts b/tests/commands/acl.ts index 7aaec2af..8c51d276 100644 --- a/tests/commands/acl.ts +++ b/tests/commands/acl.ts @@ -1,4 +1,8 @@ -import { assertEquals } from "../../deps/std/assert.ts"; +import { + assertArrayIncludes, + assertEquals, + assertStringIncludes, +} from "../../deps/std/assert.ts"; import { afterAll, beforeAll, describe, it } from "../../deps/std/testing.ts"; import type { Connector, TestServer } from "../test_util.ts"; import type { Redis } from "../../mod.ts"; @@ -23,32 +27,27 @@ export function aclTests( describe("list", () => { it("returns the ACL rules", async () => { - assertEquals(await client.aclList(), [ - "user default on nopass ~* &* +@all", - ]); + const rules = await client.aclList(); + assertStringIncludes(rules[0], "user default on nopass"); + assertEquals(rules.length, 1); }); }); describe("getuser", () => { it("returns the user's ACL flags", async () => { - assertEquals(await client.aclGetUser("default"), [ + const flags = await client.aclGetUser("default"); + assertArrayIncludes(flags, [ "flags", - ["on", "allkeys", "allchannels", "allcommands", "nopass"], "passwords", - [], "commands", - "+@all", - "keys", - ["*"], "channels", - ["*"], ]); }); }); describe("cat", () => { it("returns the available ACL categories if no arguments are given", async () => { - assertEquals( + assertArrayIncludes( (await client.aclCat()).sort(), [ "keyspace", @@ -77,23 +76,19 @@ export function aclTests( }); it("returns the commands in the specified category", async () => { - assertEquals( + assertArrayIncludes( (await client.aclCat("dangerous")).sort(), [ "lastsave", "shutdown", - "module", "monitor", "role", - "client", "replconf", - "config", "pfselftest", "save", "replicaof", "restore-asking", "restore", - "latency", "swapdb", "slaveof", "bgsave", @@ -106,13 +101,9 @@ export function aclTests( "pfdebug", "flushall", "failover", - "cluster", "info", "migrate", - "acl", - "sort", - "slowlog", - ].sort(), + ], ); }); }); diff --git a/tests/commands/string.ts b/tests/commands/string.ts index 7bc2503b..b2e7b1c7 100644 --- a/tests/commands/string.ts +++ b/tests/commands/string.ts @@ -214,7 +214,10 @@ export function stringTests( assertEquals(v, "Hello, Redis!"); }); - it("stralgo", async () => { + it("stralgo", { + // NOTE(#454): STRALGO has been dropped + ignore: !Deno.env.get("REDIS_VERSION")?.startsWith("6."), + }, async () => { await client.set("a", "Hello"); await client.set("b", "Deno!"); const matches = [