diff --git a/x-pack/platform/plugins/shared/streams/server/lib/streams/state_management/streams/wired_stream.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/state_management/streams/wired_stream.ts index 177abcc9ab95e..636715c7f22f0 100644 --- a/x-pack/platform/plugins/shared/streams/server/lib/streams/state_management/streams/wired_stream.ts +++ b/x-pack/platform/plugins/shared/streams/server/lib/streams/state_management/streams/wired_stream.ts @@ -6,7 +6,12 @@ */ import { isNotFoundError } from '@kbn/es-errors'; -import { IngestStreamLifecycle, Streams, isInheritLifecycle } from '@kbn/streams-schema'; +import { + IngestStreamLifecycle, + Streams, + findInheritedLifecycle, + isInheritLifecycle, +} from '@kbn/streams-schema'; import { getAncestors, getAncestorsAndSelf, @@ -437,6 +442,9 @@ export class WiredStream extends StreamActiveRecord { + const ancestors = await this.dependencies.streamsClient.getAncestors(this._definition.name); + const lifecycle = findInheritedLifecycle(this._definition, ancestors); + return [ { type: 'upsert_component_template', @@ -474,7 +482,7 @@ export class WiredStream extends StreamActiveRecord { + const rootDefinition = await getStream(apiClient, 'logs'); + await putStream(apiClient, 'logs', { + dashboards: [], + queries: [], + stream: { + description: '', + ingest: { + ...(rootDefinition as Streams.WiredStream.GetResponse).stream.ingest, + lifecycle: { dsl: { data_retention: '50d' } }, + }, + }, + }); + await putStream(apiClient, 'logs.inheritsatcreation', wiredPutBody); + + await expectLifecycle(['logs.inheritsatcreation'], { + dsl: { data_retention: '50d' }, + from: 'logs', + }); + }); + it('inherits dsl', async () => { // create two branches, one that inherits from root and // another one that overrides the root lifecycle