-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmisc.e2e-spec.ts
71 lines (63 loc) · 1.99 KB
/
misc.e2e-spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import * as ADCSDK from '@api7/adc-sdk';
import { BackendAPI7 } from '../src';
import {
createEvent,
deleteEvent,
dumpConfiguration,
syncEvents,
} from './support/utils';
describe('Miscellaneous', () => {
let backend: BackendAPI7;
beforeAll(() => {
backend = new BackendAPI7({
server: process.env.SERVER,
token: process.env.TOKEN,
tlsSkipVerify: true,
gatewayGroup: 'default',
});
});
describe('Sync resources with the name/description greater than 256 bytes', () => {
const routeName = ''.padEnd(64 * 1024, '0'); // 65536 bytes
const serviceName = ''.padEnd(64 * 1024, '0'); // 65536 bytes
const route = {
name: routeName,
uris: ['/test'],
};
const service = {
name: serviceName,
description: ''.padEnd(64 * 1024, '0'), // 65536 bytes
upstream: {
scheme: 'https',
nodes: [
{
host: 'httpbin.org',
port: 443,
weight: 100,
},
],
},
routes: [route],
} as ADCSDK.Service;
it('Create services', async () =>
syncEvents(backend, [
createEvent(ADCSDK.ResourceType.SERVICE, serviceName, service),
createEvent(ADCSDK.ResourceType.ROUTE, routeName, route, serviceName),
]));
it('Dump', async () => {
const result = (await dumpConfiguration(backend)) as ADCSDK.Configuration;
expect(result.services).toHaveLength(1);
expect(result.services[0]).toMatchObject(service);
expect(result.services[0]).toMatchObject(service);
expect(result.services[0].routes[0]).toMatchObject(route);
});
it('Delete service', async () =>
syncEvents(backend, [
deleteEvent(ADCSDK.ResourceType.ROUTE, routeName, serviceName),
deleteEvent(ADCSDK.ResourceType.SERVICE, serviceName),
]));
it('Dump again', async () => {
const result = (await dumpConfiguration(backend)) as ADCSDK.Configuration;
expect(result.services).toHaveLength(0);
});
});
});