|
7 | 7 | import weaviate, { WeaviateClient } from '../v2/index.js'; |
8 | 8 | import { Backend } from './index.js'; |
9 | 9 |
|
| 10 | +import { requireAtLeast } from '../../test/version'; |
10 | 11 | const { |
11 | 12 | createTestFoodSchemaAndData, |
12 | 13 | cleanupTestFood, |
@@ -950,55 +951,61 @@ describe('fails restoring backup with invalid compression config', () => { |
950 | 951 | it('cleans up', () => cleanupTestFood(client)); |
951 | 952 | }); |
952 | 953 |
|
953 | | -// describe("get all exising backups", () => { |
954 | | -// const BACKEND: Backend = 'filesystem'; |
955 | | -// const BACKUP_ID = randomBackupId() |
956 | | -// const BACKUP_ID_PIZZA = BACKUP_ID + "-pizza"; |
957 | | -// const BACKUP_ID_SOUP = BACKUP_ID + "-soup"; |
958 | | - |
959 | | -// const client = weaviate.client({ |
960 | | -// scheme: "http", |
961 | | -// host: "localhost:8080", |
962 | | -// }); |
963 | | - |
964 | | -// it("sets up", () => createTestFoodSchemaAndData(client)); |
965 | | - |
966 | | -// it("creates backup pizza", () => { |
967 | | -// return client.backup.creator() |
968 | | -// .withIncludeClassNames(PIZZA_CLASS_NAME) |
969 | | -// .withBackend(BACKEND) |
970 | | -// .withBackupId(BACKUP_ID_PIZZA) |
971 | | -// .withWaitForCompletion(true) |
972 | | -// .do() |
973 | | -// .catch((err: any) => {throw new Error("should not fail on create backup: " + err)}); |
974 | | -// }); |
975 | | - |
976 | | -// it("creates backup soup", () => { |
977 | | -// return client.backup.creator() |
978 | | -// .withIncludeClassNames(SOUP_CLASS_NAME) |
979 | | -// .withBackend(BACKEND) |
980 | | -// .withBackupId(BACKUP_ID_SOUP) |
981 | | -// .withWaitForCompletion(true) |
982 | | -// .do() |
983 | | -// .catch((err: any) => {throw new Error("should not fail on create backup: " + err)}); |
984 | | -// }); |
985 | | - |
986 | | -// it("get all", () => { |
987 | | -// return client.backup.getter() |
988 | | -// .withBackend(BACKEND) |
989 | | -// .do() |
990 | | -// .then(allResponse => { |
991 | | -// expect(allResponse).toHaveLength(2); |
992 | | -// expect(allResponse).toEqual(expect.arrayContaining([ |
993 | | -// expect.objectContaining({id: BACKUP_ID_PIZZA}), |
994 | | -// expect.objectContaining({id: BACKUP_ID_SOUP}), |
995 | | -// ])); |
996 | | -// }) |
997 | | -// .catch((err: any) => {throw new Error("should not fail on getting all: " + err)}); |
998 | | -// }); |
999 | | - |
1000 | | -// it("cleans up", () => cleanupTestFood(client)); |
1001 | | -// }); |
| 954 | +requireAtLeast(1, 30, 0).describe('get all exising backups', () => { |
| 955 | + const BACKEND: Backend = 'filesystem'; |
| 956 | + const BACKUP_ID = randomBackupId(); |
| 957 | + const BACKUP_ID_PIZZA = BACKUP_ID + '-pizza'; |
| 958 | + const BACKUP_ID_SOUP = BACKUP_ID + '-soup'; |
| 959 | + |
| 960 | + const client = weaviate.client({ |
| 961 | + scheme: 'http', |
| 962 | + host: 'localhost:8080', |
| 963 | + }); |
| 964 | + |
| 965 | + it('sets up', () => createTestFoodSchemaAndData(client)); |
| 966 | + |
| 967 | + it('creates backup pizza', () => { |
| 968 | + return client.backup |
| 969 | + .creator() |
| 970 | + .withIncludeClassNames(PIZZA_CLASS_NAME) |
| 971 | + .withBackend(BACKEND) |
| 972 | + .withBackupId(BACKUP_ID_PIZZA) |
| 973 | + .withWaitForCompletion(true) |
| 974 | + .do() |
| 975 | + .catch((err: any) => { |
| 976 | + throw new Error('should not fail on create backup: ' + err); |
| 977 | + }); |
| 978 | + }); |
| 979 | + |
| 980 | + it('creates backup soup', () => { |
| 981 | + return client.backup |
| 982 | + .creator() |
| 983 | + .withIncludeClassNames(SOUP_CLASS_NAME) |
| 984 | + .withBackend(BACKEND) |
| 985 | + .withBackupId(BACKUP_ID_SOUP) |
| 986 | + .withWaitForCompletion(true) |
| 987 | + .do() |
| 988 | + .catch((err: any) => { |
| 989 | + throw new Error('should not fail on create backup: ' + err); |
| 990 | + }); |
| 991 | + }); |
| 992 | + |
| 993 | + it('get all', () => { |
| 994 | + return client.backup |
| 995 | + .getter() |
| 996 | + .withBackend(BACKEND) |
| 997 | + .do() |
| 998 | + .then((allResponse) => { |
| 999 | + const relevant = allResponse.filter(b => b.id === BACKUP_ID_SOUP || b.id === BACKUP_ID_PIZZA); |
| 1000 | + expect(relevant).toHaveLength(2); |
| 1001 | + }) |
| 1002 | + .catch((err: any) => { |
| 1003 | + throw new Error('should not fail on getting all: ' + err); |
| 1004 | + }); |
| 1005 | + }); |
| 1006 | + |
| 1007 | + it('cleans up', () => cleanupTestFood(client)); |
| 1008 | +}); |
1002 | 1009 |
|
1003 | 1010 | function assertThatAllPizzasExist(client: WeaviateClient) { |
1004 | 1011 | return assertThatAllFoodObjectsExist(client, 'Pizza', 4); |
|
0 commit comments