Skip to content

Commit

Permalink
Merge branch '7.17' into backport/7.17/pr-186630
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Jul 3, 2024
2 parents 2f9fcd6 + 8b026e3 commit 55238b8
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 38 deletions.
28 changes: 14 additions & 14 deletions .buildkite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .buildkite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"kibana-buildkite-library": "elastic/kibana-buildkite-library#369615763abe8ba38f7a91a90d6f8cc2014f1093"
"kibana-buildkite-library": "elastic/kibana-buildkite-library#eb8ddcd9436811454da83b2581df6a484a1707ea"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const javaSettings: RawSettingDefinition[] = [
{
key: 'circuit_breaker_enabled',
label: i18n.translate('xpack.apm.agentConfig.circuitBreakerEnabled.label', {
defaultMessage: 'Cirtcuit breaker enabled',
defaultMessage: 'Circuit breaker enabled',
}),
type: 'boolean',
category: 'Circuit-Breaker',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const registerCreateRoute = ({
lib: { handleEsError },
}: RouteDependencies) => {
const bodySchema = schema.object({
id: schema.string(),
id: schema.string({ maxLength: 1000 }),
remoteCluster: schema.string(),
leaderIndexPatterns: schema.arrayOf(schema.string()),
followIndexPattern: schema.string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const registerCreateRoute = ({
lib: { handleEsError },
}: RouteDependencies) => {
const bodySchema = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
remoteCluster: schema.string(),
leaderIndex: schema.string(),
maxReadRequestOperationCount: schema.maybe(schema.number()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function createPolicy(
* We only specify a rough structure based on https://www.elastic.co/guide/en/elasticsearch/reference/current/_actions.html.
*/
const bodySchema = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
phases: schema.object({
hot: schema.any(),
warm: schema.maybe(schema.any()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { schema } from '@kbn/config-schema';

export const componentTemplateSchema = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
template: schema.object({
settings: schema.maybe(schema.object({}, { unknowns: 'allow' })),
aliases: schema.maybe(schema.object({}, { unknowns: 'allow' })),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { schema } from '@kbn/config-schema';

export const templateSchema = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
indexPatterns: schema.arrayOf(schema.string()),
version: schema.maybe(schema.number()),
order: schema.maybe(schema.number()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ import { ResolvedLogSourceConfiguration } from '../../../../common/log_sources';

const TIMESTAMP_FORMAT = 'epoch_millis';

const MAX_BUCKETS = 1000;

function getBucketIntervalStarts(
startTimestamp: number,
endTimestamp: number,
bucketSize: number
): Date[] {
// estimated number of buckets
const bucketCount = Math.ceil((endTimestamp - startTimestamp) / bucketSize);
if (bucketCount > MAX_BUCKETS) {
throw new Error(`Requested too many buckets: ${bucketCount} > ${MAX_BUCKETS}`);
}
return timeMilliseconds(new Date(startTimestamp), new Date(endTimestamp), bucketSize);
}

export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter {
constructor(private readonly framework: KibanaFramework) {}

Expand Down Expand Up @@ -132,11 +147,7 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter {
bucketSize: number,
filterQuery?: LogEntryQuery
): Promise<LogSummaryBucket[]> {
const bucketIntervalStarts = timeMilliseconds(
new Date(startTimestamp),
new Date(endTimestamp),
bucketSize
);
const bucketIntervalStarts = getBucketIntervalStarts(startTimestamp, endTimestamp, bucketSize);

const query = {
allow_no_indices: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { RouteDependencies } from '../../types';
import { pipelineSchema } from './shared';

const bodySchema = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
...pipelineSchema,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory'
import { RouteDependencies } from '../../types';

const bodyValidation = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
skipUnavailable: schema.boolean(),
mode: schema.oneOf([schema.literal(PROXY_MODE), schema.literal(SNIFF_MODE)]),
seeds: schema.nullable(schema.arrayOf(schema.string())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const registerCreateRoute = ({
body: schema.object({
job: schema.object(
{
id: schema.string(),
id: schema.string({ maxLength: 1000 }),
},
{ unknowns: 'allow' }
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export const snapshotListSchema = schema.object({
});

export const policySchema = schema.object({
name: schema.string(),
snapshotName: schema.string(),
name: schema.string({ maxLength: 1000 }),
snapshotName: schema.string({ maxLength: 1000 }),
schedule: schema.string(),
repository: schema.string(),
config: schema.maybe(snapshotConfigSchema),
Expand All @@ -71,7 +71,7 @@ const fsRepositorySettings = schema.object({
});

const fsRepositorySchema = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
type: schema.string(),
settings: fsRepositorySettings,
});
Expand All @@ -81,7 +81,7 @@ const readOnlyRepositorySettings = schema.object({
});

const readOnlyRepository = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
type: schema.string(),
settings: readOnlyRepositorySettings,
});
Expand All @@ -102,7 +102,7 @@ const s3RepositorySettings = schema.object({
});

const s3Repository = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
type: schema.string(),
settings: s3RepositorySettings,
});
Expand All @@ -123,7 +123,7 @@ const hdsRepositorySettings = schema.object(
);

const hdsfRepository = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
type: schema.string(),
settings: hdsRepositorySettings,
});
Expand All @@ -141,7 +141,7 @@ const azureRepositorySettings = schema.object({
});

const azureRepository = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
type: schema.string(),
settings: azureRepositorySettings,
});
Expand All @@ -158,13 +158,13 @@ const gcsRepositorySettings = schema.object({
});

const gcsRepository = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
type: schema.string(),
settings: gcsRepositorySettings,
});

const sourceRepository = schema.object({
name: schema.string(),
name: schema.string({ maxLength: 1000 }),
type: schema.string(),
settings: schema.oneOf([
fsRepositorySettings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ export default function ({ getService }: FtrProviderContext) {
message: `There is already a pipeline with name '${PIPELINE_ID}'.`,
});
});

it(`doesn't allow to create a pipeline with a too long name`, async () => {
const pipelineRequestBody = {
name: 'testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest1',
};
await supertest
.post(API_BASE_PATH)
.set('kbn-xsrf', 'xxx')
.send(pipelineRequestBody)
.expect(400);
});
});

describe('Update', () => {
Expand Down

0 comments on commit 55238b8

Please sign in to comment.