Skip to content

Commit

Permalink
Merge pull request #216 from redis/update-node-versions
Browse files Browse the repository at this point in the history
Update node versions
  • Loading branch information
guyroyse authored Oct 27, 2023
2 parents 934d4bb + cefa774 commit 31d7da0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
name: Test All
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18, 20]
services:
Expand All @@ -26,17 +27,16 @@ jobs:
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.3.0
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache dependencies
uses: c-hive/gha-npm-cache@v1

- name: Update npm
run: npm install --global npm
if: ${{ matrix.node-version <= 14 }}

- name: Install packages
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion lib/repository/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class Repository {
/* NOTE: It would be better if this error handler was only around the call
to `.dropIndex`. Might muss up the code a bit though. Life is full of
tough choices. */
if (e instanceof Error && e.message === "Unknown Index name") {
if (e instanceof Error && (e.message === "Unknown Index name" || e.message === "Unknown index name")) {
// no-op: the thing we are dropping doesn't exist
} else {
throw e
Expand Down
6 changes: 3 additions & 3 deletions spec/functional/search/create-and-drop-index-on-hash.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { fetchIndexHash, fetchIndexInfo, removeKeys } from '../helpers/redis-hel
const expected = [
{ identifier: 'root_aString', attribute: 'aString', type: 'TAG', SEPARATOR: '|' },
{ identifier: 'root_someText', attribute: 'someText', type: 'TEXT', WEIGHT: '1', SORTABLE: undefined },
{ identifier: 'root_aNumber', attribute: 'aNumber', type: 'NUMERIC', SORTABLE: undefined },
{ identifier: 'root_aNumber', attribute: 'aNumber', type: 'NUMERIC', SORTABLE: 'UNF' },
{ identifier: 'root_aBoolean', attribute: 'aBoolean', type: 'TAG', SEPARATOR: ',' },
{ identifier: 'root_aPoint', attribute: 'aPoint', type: 'GEO' },
{ identifier: 'root_aDate', attribute: 'aDate', type: 'NUMERIC', SORTABLE: undefined },
{ identifier: 'root_aDate', attribute: 'aDate', type: 'NUMERIC', SORTABLE: 'UNF' },
{ identifier: 'root_someStrings', attribute: 'someStrings', type: 'TAG', SEPARATOR: '|' },
]

Expand Down Expand Up @@ -71,7 +71,7 @@ describe("create and drop index on hash", () => {

it("the index no longer exists", async () => {
expect(async () => await fetchIndexInfo(redis, 'create-drop-hash:index'))
.rejects.toThrow("Unknown Index name")
.rejects.toThrow("Unknown index name")
})

it("the index hash no longer exists", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe("create and drop index on JSON", () => {

it("the index no longer exists", () => {
expect(async () => await fetchIndexInfo(redis, 'create-drop-json:index'))
.rejects.toThrow("Unknown Index name")
.rejects.toThrow("Unknown index name")
})

it("the index hash no longer exists", async () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/functional/search/drop-missing-index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("drop missing index on hash", () => {

it("the index still doesn't exists", () => {
expect(async () => await fetchIndexInfo(redis, 'drop-missing:index'))
.rejects.toThrow("Unknown Index name")
.rejects.toThrow("Unknown index name")
})
})
})
10 changes: 9 additions & 1 deletion spec/unit/repository/repository-drop-index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ describe("Repository", () => {

describe("when the index doesn't exist", () => {
beforeEach(async () => {
vi.mocked(client.dropIndex).mockRejectedValue(Error("Unknown Index name"))
vi.mocked(client.dropIndex).mockRejectedValue(Error("Unknown index name"))
})

it("eats the exception", async () => await repository.dropIndex()) // it doesn't throw an exception
})

describe("when the index doesn't exist for newer versions of Redis", () => {
beforeEach(async () => {
vi.mocked(client.dropIndex).mockRejectedValue(Error("Unknown index name"))
})

it("eats the exception", async () => await repository.dropIndex()) // it doesn't throw an exception
Expand Down

0 comments on commit 31d7da0

Please sign in to comment.