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.
[Uptime] Update functional test directory to use a pinned version of …
…package registry via docker (elastic#117736) * update functional test directory to use a pinned version of package registry via docker * remove console log * adjust config * skip synthetics tests if no docker image * remove extra configs * move synthetics tests to a different directory * update tests * update tests * remove duplicate tests * update helpers Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> # Conflicts: # x-pack/test/functional_synthetics/apps/uptime/synthetics_integration.ts
- Loading branch information
1 parent
919c0d0
commit fcfbde5
Showing
20 changed files
with
267 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
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
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,4 @@ | ||
package_paths: | ||
- /packages/production | ||
- /packages/staging | ||
- /packages/snapshot |
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
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
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,3 @@ | ||
# Kibana Functional Testing | ||
|
||
See our [Functional Testing Guide](https://www.elastic.co/guide/en/kibana/current/development-tests.html#development-functional-tests) |
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,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default ({ loadTestFile, getService }: FtrProviderContext) => { | ||
describe('Uptime app', function () { | ||
describe('with generated data', () => { | ||
loadTestFile(require.resolve('./synthetics_integration')); | ||
}); | ||
}); | ||
}; |
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
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,111 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import path, { resolve } from 'path'; | ||
|
||
import { defineDockerServersConfig } from '@kbn/test'; | ||
|
||
import { services } from './services'; | ||
import { pageObjects } from './page_objects'; | ||
|
||
// Docker image to use for Fleet API integration tests. | ||
// This hash comes from the latest successful build of the Snapshot Distribution of the Package Registry, for | ||
// example: https://beats-ci.elastic.co/blue/organizations/jenkins/Ingest-manager%2Fpackage-storage/detail/snapshot/74/pipeline/257#step-302-log-1. | ||
// It should be updated any time there is a new Docker image published for the Snapshot Distribution of the Package Registry that updates Synthetics. | ||
export const dockerImage = | ||
'docker.elastic.co/package-registry/distribution:48202133e7506873aff3cc7c3b1d284158727779'; | ||
|
||
// the default export of config files must be a config provider | ||
// that returns an object with the projects config values | ||
export default async function ({ readConfigFile }) { | ||
const registryPort = process.env.FLEET_PACKAGE_REGISTRY_PORT; | ||
|
||
const kibanaCommonConfig = await readConfigFile( | ||
require.resolve('../../../test/common/config.js') | ||
); | ||
const kibanaFunctionalConfig = await readConfigFile( | ||
require.resolve('../../../test/functional/config.js') | ||
); | ||
|
||
// mount the config file for the package registry as well as | ||
// the directory containing additional packages into the container | ||
const dockerArgs = [ | ||
'-v', | ||
`${path.join( | ||
path.dirname(__filename), | ||
'./fixtures/package_registry_config.yml' | ||
)}:/package-registry/config.yml`, | ||
]; | ||
|
||
return { | ||
// list paths to the files that contain your plugins tests | ||
testFiles: [resolve(__dirname, './apps/uptime')], | ||
|
||
services, | ||
pageObjects, | ||
|
||
servers: kibanaFunctionalConfig.get('servers'), | ||
|
||
esTestCluster: { | ||
license: 'trial', | ||
from: 'snapshot', | ||
serverArgs: ['path.repo=/tmp/', 'xpack.security.authc.api_key.enabled=true'], | ||
}, | ||
|
||
kbnTestServer: { | ||
...kibanaCommonConfig.get('kbnTestServer'), | ||
serverArgs: [ | ||
...kibanaCommonConfig.get('kbnTestServer.serverArgs'), | ||
'--status.allowAnonymous=true', | ||
'--server.uuid=5b2de169-2785-441b-ae8c-186a1936b17d', | ||
'--xpack.maps.showMapsInspectorAdapter=true', | ||
'--xpack.maps.preserveDrawingBuffer=true', | ||
'--xpack.security.encryptionKey="wuGNaIhoMpk5sO4UBxgr3NyW1sFcLgIf"', // server restarts should not invalidate active sessions | ||
'--xpack.encryptedSavedObjects.encryptionKey="DkdXazszSCYexXqz4YktBGHCRkV6hyNK"', | ||
'--xpack.discoverEnhanced.actions.exploreDataInContextMenu.enabled=true', | ||
'--savedObjects.maxImportPayloadBytes=10485760', // for OSS test management/_import_objects, | ||
...(registryPort ? [`--xpack.fleet.registryUrl=http://localhost:${registryPort}`] : []), | ||
], | ||
}, | ||
uiSettings: { | ||
defaults: { | ||
'accessibility:disableAnimations': true, | ||
'dateFormat:tz': 'UTC', | ||
'visualization:visualize:legacyPieChartsLibrary': true, | ||
}, | ||
}, | ||
// the apps section defines the urls that | ||
// `PageObjects.common.navigateTo(appKey)` will use. | ||
// Merge urls for your plugin with the urls defined in | ||
// Kibana's config in order to use this helper | ||
apps: { | ||
...kibanaFunctionalConfig.get('apps'), | ||
fleet: { | ||
pathname: '/app/fleet', | ||
}, | ||
}, | ||
|
||
// choose where screenshots should be saved | ||
screenshots: { | ||
directory: resolve(__dirname, 'screenshots'), | ||
}, | ||
|
||
junit: { | ||
reportName: 'Chrome Elastic Synthetics Integration UI Functional Tests', | ||
}, | ||
dockerServers: defineDockerServersConfig({ | ||
registry: { | ||
enabled: !!registryPort, | ||
image: dockerImage, | ||
portInContainer: 8080, | ||
port: registryPort, | ||
args: dockerArgs, | ||
waitForLogLine: 'package manifests loaded', | ||
}, | ||
}), | ||
}; | ||
} |
4 changes: 4 additions & 0 deletions
4
x-pack/test/functional_synthetics/fixtures/package_registry_config.yml
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,4 @@ | ||
package_paths: | ||
- /packages/production | ||
- /packages/staging | ||
- /packages/snapshot |
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,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { GenericFtrProviderContext, GenericFtrService } from '@kbn/test'; | ||
|
||
import { pageObjects } from './page_objects'; | ||
import { services } from './services'; | ||
|
||
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>; | ||
export class FtrService extends GenericFtrService<FtrProviderContext> {} |
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,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { Context } from 'mocha'; | ||
import { ToolingLog } from '@kbn/dev-utils'; | ||
import { FtrProviderContext } from './ftr_provider_context'; | ||
|
||
export function warnAndSkipTest(mochaContext: Context, log: ToolingLog) { | ||
log.warning( | ||
'disabling tests because DockerServers service is not enabled, set FLEET_PACKAGE_REGISTRY_PORT to run them' | ||
); | ||
mochaContext.skip(); | ||
} | ||
|
||
export function skipIfNoDockerRegistry(providerContext: FtrProviderContext) { | ||
const { getService } = providerContext; | ||
const dockerServers = getService('dockerServers'); | ||
|
||
const server = dockerServers.get('registry'); | ||
const log = getService('log'); | ||
|
||
beforeEach(function beforeSetupWithDockerRegistry() { | ||
if (!server.enabled) { | ||
warnAndSkipTest(this, log); | ||
} | ||
}); | ||
} |
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,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { pageObjects as kibanaFunctionalPageObjects } from '../../../../test/functional/page_objects'; | ||
|
||
import { SyntheticsIntegrationPageProvider } from './synthetics_integration_page'; | ||
|
||
// just like services, PageObjects are defined as a map of | ||
// names to Providers. Merge in Kibana's or pick specific ones | ||
export const pageObjects = { | ||
...kibanaFunctionalPageObjects, | ||
syntheticsIntegration: SyntheticsIntegrationPageProvider, | ||
}; |
Oops, something went wrong.