1
1
import * as ADCSDK from '@api7/adc-sdk' ;
2
- import { unset } from 'lodash' ;
3
- import { readFileSync } from 'node:fs' ;
4
- import { join } from 'node:path' ;
5
2
6
3
import { BackendAPI7 } from '../src' ;
7
4
import {
8
5
createEvent ,
9
6
deleteEvent ,
10
7
dumpConfiguration ,
11
8
syncEvents ,
12
- updateEvent ,
13
9
} from './support/utils' ;
14
10
15
11
describe ( 'Miscellaneous' , ( ) => {
@@ -24,10 +20,15 @@ describe('Miscellaneous', () => {
24
20
} ) ;
25
21
} ) ;
26
22
27
- describe ( 'Sync resources with the description greater than 256 bytes' , ( ) => {
28
- const service1Name = 'service1' ;
29
- const service1 = {
30
- name : service1Name ,
23
+ describe ( 'Sync resources with the name/description greater than 256 bytes' , ( ) => {
24
+ const routeName = '' . padEnd ( 64 * 1024 , '0' ) ; // 65536 bytes
25
+ const serviceName = '' . padEnd ( 64 * 1024 , '0' ) ; // 65536 bytes
26
+ const route = {
27
+ name : routeName ,
28
+ uris : [ '/test' ] ,
29
+ } ;
30
+ const service = {
31
+ name : serviceName ,
31
32
description : '' . padEnd ( 64 * 1024 , '0' ) , // 65536 bytes
32
33
upstream : {
33
34
scheme : 'https' ,
@@ -39,22 +40,27 @@ describe('Miscellaneous', () => {
39
40
} ,
40
41
] ,
41
42
} ,
43
+ routes : [ route ] ,
42
44
} as ADCSDK . Service ;
43
45
44
46
it ( 'Create services' , async ( ) =>
45
47
syncEvents ( backend , [
46
- createEvent ( ADCSDK . ResourceType . SERVICE , service1Name , service1 ) ,
48
+ createEvent ( ADCSDK . ResourceType . SERVICE , serviceName , service ) ,
49
+ createEvent ( ADCSDK . ResourceType . ROUTE , routeName , route , serviceName ) ,
47
50
] ) ) ;
48
51
49
52
it ( 'Dump' , async ( ) => {
50
53
const result = ( await dumpConfiguration ( backend ) ) as ADCSDK . Configuration ;
51
54
expect ( result . services ) . toHaveLength ( 1 ) ;
52
- expect ( result . services [ 0 ] ) . toMatchObject ( service1 ) ;
55
+ expect ( result . services [ 0 ] ) . toMatchObject ( service ) ;
56
+ expect ( result . services [ 0 ] ) . toMatchObject ( service ) ;
57
+ expect ( result . services [ 0 ] . routes [ 0 ] ) . toMatchObject ( route ) ;
53
58
} ) ;
54
59
55
60
it ( 'Delete service' , async ( ) =>
56
61
syncEvents ( backend , [
57
- deleteEvent ( ADCSDK . ResourceType . SERVICE , service1Name ) ,
62
+ deleteEvent ( ADCSDK . ResourceType . ROUTE , routeName , serviceName ) ,
63
+ deleteEvent ( ADCSDK . ResourceType . SERVICE , serviceName ) ,
58
64
] ) ) ;
59
65
60
66
it ( 'Dump again' , async ( ) => {
0 commit comments