mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
delete testbed plugins (#69661)
* delete testbed plugins * remove FTR tests based on KP testbed
This commit is contained in:
parent
d25ced2dd3
commit
e0449400eb
12 changed files with 0 additions and 313 deletions
|
@ -34,9 +34,7 @@ export const CopySourceTask = {
|
|||
'!src/test_utils/**',
|
||||
'!src/fixtures/**',
|
||||
'!src/legacy/core_plugins/tests_bundle/**',
|
||||
'!src/legacy/core_plugins/testbed/**',
|
||||
'!src/legacy/core_plugins/console/public/tests/**',
|
||||
'!src/plugins/testbed/**',
|
||||
'!src/cli/cluster/**',
|
||||
'!src/cli/repl/**',
|
||||
'!src/es_archiver/**',
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
## Kibana Testbed
|
||||
|
||||
Sometimes when developing for Kibana, it is useful to have an isolated routable space to demonstrate new functionality. This Testbed provides such a space.
|
||||
|
||||
To make use of the testbed, edit the testbed.js, testbed.html, and testbed.less files as necessary. When you are done demonstrating
|
||||
your new functionality, remember to cleanup your changes and restore the testbed to its pristine state for the next person.
|
||||
|
||||
To access the testbed, visit `http://localhost:5601/app/kibana#/testbed`
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { resolve } from 'path';
|
||||
|
||||
export default function (kibana) {
|
||||
return new kibana.Plugin({
|
||||
id: 'testbed',
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
uiExports: {
|
||||
hacks: ['plugins/testbed'],
|
||||
},
|
||||
});
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"name": "testbed",
|
||||
"version": "kibana"
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import './testbed';
|
|
@ -1,12 +0,0 @@
|
|||
<div class="kuiViewContent">
|
||||
<div class="kuiViewContentItem">
|
||||
|
||||
<pre ng-if="testbed.data">{{ testbed.data }}</pre>
|
||||
|
||||
<!-- All markup within the CONTENT section below can be deleted and replaced with whatever markup you need to demonstrate your functionality. Nothing need be preserved. -->
|
||||
<!-- CONTENT START -->
|
||||
|
||||
<!-- CONTENT END -->
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import uiRoutes from 'ui/routes';
|
||||
import template from './testbed.html';
|
||||
|
||||
uiRoutes.when('/testbed', {
|
||||
template: template,
|
||||
controllerAs: 'testbed',
|
||||
controller: class TestbedController {
|
||||
constructor() {}
|
||||
},
|
||||
});
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"id": "testbed",
|
||||
"version": "0.0.1",
|
||||
"kibanaVersion": "kibana",
|
||||
"configPath": ["core", "testbed"],
|
||||
"server": true,
|
||||
"ui": true
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { PluginInitializer, PluginInitializerContext } from 'kibana/public';
|
||||
import { TestbedPlugin, TestbedPluginSetup, TestbedPluginStart } from './plugin';
|
||||
|
||||
export const plugin: PluginInitializer<TestbedPluginSetup, TestbedPluginStart> = (
|
||||
initializerContext: PluginInitializerContext
|
||||
) => new TestbedPlugin(initializerContext);
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { Plugin, CoreSetup, PluginInitializerContext } from 'kibana/public';
|
||||
|
||||
interface ConfigType {
|
||||
uiProp: string;
|
||||
}
|
||||
|
||||
export class TestbedPlugin implements Plugin<TestbedPluginSetup, TestbedPluginStart> {
|
||||
constructor(private readonly initializerContext: PluginInitializerContext) {}
|
||||
|
||||
public async setup(core: CoreSetup, deps: {}) {
|
||||
const config = this.initializerContext.config.get<ConfigType>();
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Testbed plugin set up. uiProp: '${config.uiProp}'`);
|
||||
return {
|
||||
foo: 'bar',
|
||||
};
|
||||
}
|
||||
|
||||
public start() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Testbed plugin started`);
|
||||
}
|
||||
|
||||
public stop() {}
|
||||
}
|
||||
|
||||
export type TestbedPluginSetup = ReturnType<TestbedPlugin['setup']>;
|
||||
export type TestbedPluginStart = ReturnType<TestbedPlugin['start']>;
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { map } from 'rxjs/operators';
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
||||
import {
|
||||
CoreSetup,
|
||||
CoreStart,
|
||||
Logger,
|
||||
PluginInitializerContext,
|
||||
PluginConfigDescriptor,
|
||||
PluginName,
|
||||
} from 'kibana/server';
|
||||
|
||||
const configSchema = schema.object({
|
||||
secret: schema.string({ defaultValue: 'Not really a secret :/' }),
|
||||
uiProp: schema.string({ defaultValue: 'Accessible from client' }),
|
||||
});
|
||||
|
||||
type ConfigType = TypeOf<typeof configSchema>;
|
||||
|
||||
export const config: PluginConfigDescriptor = {
|
||||
exposeToBrowser: {
|
||||
uiProp: true,
|
||||
},
|
||||
schema: configSchema,
|
||||
deprecations: ({ rename, unused, renameFromRoot }) => [
|
||||
rename('securityKey', 'secret'),
|
||||
renameFromRoot('oldtestbed.uiProp', 'testbed.uiProp'),
|
||||
unused('deprecatedProperty'),
|
||||
],
|
||||
};
|
||||
|
||||
class Plugin {
|
||||
private readonly log: Logger;
|
||||
|
||||
constructor(private readonly initializerContext: PluginInitializerContext) {
|
||||
this.log = this.initializerContext.logger.get();
|
||||
}
|
||||
|
||||
public setup(core: CoreSetup, deps: Record<PluginName, unknown>) {
|
||||
this.log.debug(
|
||||
`Setting up TestBed with core contract [${Object.keys(core)}] and deps [${Object.keys(deps)}]`
|
||||
);
|
||||
|
||||
const router = core.http.createRouter();
|
||||
router.get(
|
||||
{ path: '/requestcontext/elasticsearch', validate: false },
|
||||
async (context, req, res) => {
|
||||
const response = await context.core.elasticsearch.legacy.client.callAsInternalUser('ping');
|
||||
return res.ok({ body: `Elasticsearch: ${response}` });
|
||||
}
|
||||
);
|
||||
|
||||
router.get(
|
||||
{ path: '/requestcontext/savedobjectsclient', validate: false },
|
||||
async (context, req, res) => {
|
||||
const response = await context.core.savedObjects.client.find({ type: 'TYPE' });
|
||||
return res.ok({ body: `SavedObjects client: ${JSON.stringify(response)}` });
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
data$: this.initializerContext.config.create<ConfigType>().pipe(
|
||||
map((configValue) => {
|
||||
this.log.debug(`I've got value from my config: ${configValue.secret}`);
|
||||
return `Some exposed data derived from config: ${configValue.secret}`;
|
||||
})
|
||||
),
|
||||
pingElasticsearch: async () => {
|
||||
const [coreStart] = await core.getStartServices();
|
||||
return coreStart.elasticsearch.legacy.client.callAsInternalUser('ping');
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public start(core: CoreStart, deps: Record<PluginName, unknown>) {
|
||||
this.log.debug(
|
||||
`Starting up TestBed testbed with core contract [${Object.keys(
|
||||
core
|
||||
)}] and deps [${Object.keys(deps)}]`
|
||||
);
|
||||
|
||||
return {
|
||||
getStartContext() {
|
||||
return core;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public stop() {
|
||||
this.log.debug(`Stopping TestBed`);
|
||||
}
|
||||
}
|
||||
|
||||
export const plugin = (initializerContext: PluginInitializerContext) =>
|
||||
new Plugin(initializerContext);
|
|
@ -22,19 +22,6 @@ export default function ({ getService }) {
|
|||
const supertest = getService('supertest');
|
||||
|
||||
describe('core', () => {
|
||||
describe('request context', () => {
|
||||
it('provides access to elasticsearch', async () =>
|
||||
await supertest.get('/requestcontext/elasticsearch').expect(200, 'Elasticsearch: true'));
|
||||
|
||||
it('provides access to SavedObjects client', async () =>
|
||||
await supertest
|
||||
.get('/requestcontext/savedobjectsclient')
|
||||
.expect(
|
||||
200,
|
||||
'SavedObjects client: {"page":1,"per_page":20,"total":0,"saved_objects":[]}'
|
||||
));
|
||||
});
|
||||
|
||||
describe('compression', () => {
|
||||
it(`uses compression when there isn't a referer`, async () => {
|
||||
await supertest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue