Skip to content

Commit

Permalink
Copy esArchiver commands from ./reassign.ts to fix tests (#97012) (#9…
Browse files Browse the repository at this point in the history
…7037)

## Summary

Seeing failures like this locally for `x-pack/test/fleet_api_integration/apis/agents/unenroll.ts` tests
<details><summary>screenshot of error</summary>
<img width="1121" alt="Screen Shot 2021-04-13 at 10 06 51 AM" src="https://user-images.githubusercontent.com/57655/114592495-fec04280-9c58-11eb-939c-b84aa7469c2a.png">
</details>
Copied the `esArchiver` patterns from `x-pack/test/fleet_api_integration/apis/agents/reassign.ts` in #96837 and the error is gone

### Checklist
- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios

Co-authored-by: John Schulz <john.schulz@elastic.co>
  • Loading branch information
kibanamachine and John Schulz committed Apr 13, 2021
1 parent 52d4c8d commit d657179
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions x-pack/test/fleet_api_integration/apis/agents/unenroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ export default function (providerContext: FtrProviderContext) {
let accessAPIKeyId: string;
let outputAPIKeyId: string;
before(async () => {
await esArchiver.load('fleet/agents');
await esArchiver.load('fleet/empty_fleet_server');
});
setupFleetAndAgents(providerContext);
beforeEach(async () => {
await esArchiver.unload('fleet/empty_fleet_server');
await esArchiver.load('fleet/agents');
const { body: accessAPIKeyBody } = await esClient.security.createApiKey({
body: {
name: `test access api key: ${uuid.v4()}`,
Expand Down Expand Up @@ -63,8 +65,12 @@ export default function (providerContext: FtrProviderContext) {
},
});
});
after(async () => {
afterEach(async () => {
await esArchiver.unload('fleet/agents');
await esArchiver.load('fleet/empty_fleet_server');
});
after(async () => {
await esArchiver.unload('fleet/empty_fleet_server');
});

it('/agents/{agent_id}/unenroll should fail for managed policy', async () => {
Expand Down

0 comments on commit d657179

Please sign in to comment.