Skip to content

Commit 79fe647

Browse files
authored
Fix integration tests by removing sample flight data download (#2202)
1 parent 5d890b9 commit 79fe647

File tree

2 files changed

+25
-91
lines changed

2 files changed

+25
-91
lines changed

test/jest_integration/jwt_auth.test.ts

Lines changed: 25 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,6 @@ describe('start OpenSearch Dashboards server', () => {
9797
authorization: ADMIN_CREDENTIALS,
9898
},
9999
});
100-
console.log('Starting to Download Flights Sample Data');
101-
await wreck.post('http://localhost:5601/api/sample_data/flights', {
102-
payload: {},
103-
rejectUnauthorized: false,
104-
headers: {
105-
'Content-Type': 'application/json',
106-
authorization: ADMIN_CREDENTIALS,
107-
security_tenant: 'global',
108-
},
109-
});
110-
console.log('Downloaded Sample Data');
111100
const getConfigResponse = await wreck.get(
112101
'https://localhost:9200/_plugins/_security/api/securityconfig',
113102
{
@@ -158,64 +147,35 @@ describe('start OpenSearch Dashboards server', () => {
158147
});
159148

160149
afterAll(async () => {
161-
console.log('Remove the Sample Data');
162-
await wreck
163-
.delete('http://localhost:5601/api/sample_data/flights', {
164-
rejectUnauthorized: false,
165-
headers: {
166-
'Content-Type': 'application/json',
167-
authorization: ADMIN_CREDENTIALS,
168-
},
169-
})
170-
.then((value) => {
171-
Promise.resolve(value);
172-
})
173-
.catch((value) => {
174-
Promise.resolve(value);
175-
});
176150
console.log('Remove the Role Mapping');
177-
await wreck
178-
.patch('https://localhost:9200/_plugins/_security/api/rolesmapping/all_access', {
179-
payload: [
180-
{
181-
op: 'remove',
182-
path: '/users',
183-
users: ['jwt_test'],
184-
},
185-
],
186-
rejectUnauthorized: false,
187-
headers: {
188-
'Content-Type': 'application/json',
189-
authorization: ADMIN_CREDENTIALS,
151+
await wreck.patch('https://localhost:9200/_plugins/_security/api/rolesmapping/all_access', {
152+
payload: [
153+
{
154+
op: 'remove',
155+
path: '/users',
156+
users: ['jwt_test'],
190157
},
191-
})
192-
.then((value) => {
193-
Promise.resolve(value);
194-
})
195-
.catch((value) => {
196-
Promise.resolve(value);
197-
});
158+
],
159+
rejectUnauthorized: false,
160+
headers: {
161+
'Content-Type': 'application/json',
162+
authorization: ADMIN_CREDENTIALS,
163+
},
164+
});
198165
console.log('Remove the Security Config');
199-
await wreck
200-
.patch('https://localhost:9200/_plugins/_security/api/securityconfig', {
201-
payload: [
202-
{
203-
op: 'remove',
204-
path: '/config/dynamic/authc/jwt_auth_domain',
205-
},
206-
],
207-
rejectUnauthorized: false,
208-
headers: {
209-
'Content-Type': 'application/json',
210-
authorization: ADMIN_CREDENTIALS,
166+
await wreck.patch('https://localhost:9200/_plugins/_security/api/securityconfig', {
167+
payload: [
168+
{
169+
op: 'remove',
170+
path: '/config/dynamic/authc/jwt_auth_domain',
211171
},
212-
})
213-
.then((value) => {
214-
Promise.resolve(value);
215-
})
216-
.catch((value) => {
217-
Promise.resolve(value);
218-
});
172+
],
173+
rejectUnauthorized: false,
174+
headers: {
175+
'Content-Type': 'application/json',
176+
authorization: ADMIN_CREDENTIALS,
177+
},
178+
});
219179
// shutdown OpenSearchDashboards server
220180
await root.shutdown();
221181
});

test/jest_integration/proxy_multiauth.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,6 @@ describe('start OpenSearch Dashboards server', () => {
9090
await root.setup();
9191
await root.start();
9292

93-
console.log('Starting to Download Flights Sample Data');
94-
await wreck.post('http://localhost:5601/api/sample_data/flights', {
95-
payload: {},
96-
rejectUnauthorized: false,
97-
headers: {
98-
'Content-Type': 'application/json',
99-
authorization: ADMIN_CREDENTIALS,
100-
security_tenant: 'global',
101-
},
102-
});
103-
console.log('Downloaded Sample Data');
10493
const getConfigResponse = await wreck.get(
10594
'https://localhost:9200/_plugins/_security/api/securityconfig',
10695
{
@@ -148,21 +137,6 @@ describe('start OpenSearch Dashboards server', () => {
148137
});
149138

150139
afterAll(async () => {
151-
console.log('Remove the Sample Data');
152-
await wreck
153-
.delete('http://localhost:5601/api/sample_data/flights', {
154-
rejectUnauthorized: false,
155-
headers: {
156-
'Content-Type': 'application/json',
157-
authorization: ADMIN_CREDENTIALS,
158-
},
159-
})
160-
.then((value) => {
161-
Promise.resolve(value);
162-
})
163-
.catch((value) => {
164-
Promise.resolve(value);
165-
});
166140
console.log('Remove the Security Config');
167141
await wreck
168142
.patch('https://localhost:9200/_plugins/_security/api/securityconfig', {

0 commit comments

Comments
 (0)