forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ingest Manager] Fix agent version check to work with SNAPSHOT versio…
…ns (elastic#70796) (elastic#70838)
- Loading branch information
Showing
2 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
x-pack/plugins/ingest_manager/server/services/agents/enroll.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { validateAgentVersion } from './enroll'; | ||
import { appContextService } from '../app_context'; | ||
import { IngestManagerAppContext } from '../../plugin'; | ||
|
||
describe('validateAgentVersion', () => { | ||
it('should throw with agent > kibana version', () => { | ||
appContextService.start(({ | ||
kibanaVersion: '8.0.0', | ||
} as unknown) as IngestManagerAppContext); | ||
expect(() => | ||
validateAgentVersion({ | ||
local: { elastic: { agent: { version: '8.8.0' } } }, | ||
userProvided: {}, | ||
}) | ||
).toThrowError(/Agent version is not compatible with kibana version/); | ||
}); | ||
it('should work with agent < kibana version', () => { | ||
appContextService.start(({ | ||
kibanaVersion: '8.0.0', | ||
} as unknown) as IngestManagerAppContext); | ||
validateAgentVersion({ local: { elastic: { agent: { version: '7.8.0' } } }, userProvided: {} }); | ||
}); | ||
|
||
it('should work with agent = kibana version', () => { | ||
appContextService.start(({ | ||
kibanaVersion: '8.0.0', | ||
} as unknown) as IngestManagerAppContext); | ||
validateAgentVersion({ local: { elastic: { agent: { version: '8.0.0' } } }, userProvided: {} }); | ||
}); | ||
|
||
it('should work with SNAPSHOT version', () => { | ||
appContextService.start(({ | ||
kibanaVersion: '8.0.0-SNAPSHOT', | ||
} as unknown) as IngestManagerAppContext); | ||
validateAgentVersion({ | ||
local: { elastic: { agent: { version: '8.0.0-SNAPSHOT' } } }, | ||
userProvided: {}, | ||
}); | ||
}); | ||
|
||
it('should work with a agent using SNAPSHOT version', () => { | ||
appContextService.start(({ | ||
kibanaVersion: '7.8.0', | ||
} as unknown) as IngestManagerAppContext); | ||
validateAgentVersion({ | ||
local: { elastic: { agent: { version: '7.8.0-SNAPSHOT' } } }, | ||
userProvided: {}, | ||
}); | ||
}); | ||
|
||
it('should work with a kibana using SNAPSHOT version', () => { | ||
appContextService.start(({ | ||
kibanaVersion: '7.8.0-SNAPSHOT', | ||
} as unknown) as IngestManagerAppContext); | ||
validateAgentVersion({ | ||
local: { elastic: { agent: { version: '7.8.0' } } }, | ||
userProvided: {}, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters