@@ -52,6 +52,117 @@ describe('Config Deprecations', () => {
5252 ` ) ;
5353 } ) ;
5454
55+ it ( 'renames audit.appender.kind to audit.appender.type' , ( ) => {
56+ const config = {
57+ xpack : {
58+ security : {
59+ audit : {
60+ appender : {
61+ kind : 'console' ,
62+ } ,
63+ } ,
64+ } ,
65+ } ,
66+ } ;
67+ const { messages, migrated } = applyConfigDeprecations ( cloneDeep ( config ) ) ;
68+ expect ( migrated . xpack . security . audit . appender . kind ) . not . toBeDefined ( ) ;
69+ expect ( migrated . xpack . security . audit . appender . type ) . toEqual ( 'console' ) ;
70+ expect ( messages ) . toMatchInlineSnapshot ( `
71+ Array [
72+ "\\"xpack.security.audit.appender.kind\\" is deprecated and has been replaced by \\"xpack.security.audit.appender.type\\"",
73+ ]
74+ ` ) ;
75+ } ) ;
76+
77+ it ( 'renames audit.appender.layout.kind to audit.appender.layout.type' , ( ) => {
78+ const config = {
79+ xpack : {
80+ security : {
81+ audit : {
82+ appender : {
83+ layout : { kind : 'pattern' } ,
84+ } ,
85+ } ,
86+ } ,
87+ } ,
88+ } ;
89+ const { messages, migrated } = applyConfigDeprecations ( cloneDeep ( config ) ) ;
90+ expect ( migrated . xpack . security . audit . appender . layout . kind ) . not . toBeDefined ( ) ;
91+ expect ( migrated . xpack . security . audit . appender . layout . type ) . toEqual ( 'pattern' ) ;
92+ expect ( messages ) . toMatchInlineSnapshot ( `
93+ Array [
94+ "\\"xpack.security.audit.appender.layout.kind\\" is deprecated and has been replaced by \\"xpack.security.audit.appender.layout.type\\"",
95+ ]
96+ ` ) ;
97+ } ) ;
98+
99+ it ( 'renames audit.appender.policy.kind to audit.appender.policy.type' , ( ) => {
100+ const config = {
101+ xpack : {
102+ security : {
103+ audit : {
104+ appender : {
105+ policy : { kind : 'time-interval' } ,
106+ } ,
107+ } ,
108+ } ,
109+ } ,
110+ } ;
111+ const { messages, migrated } = applyConfigDeprecations ( cloneDeep ( config ) ) ;
112+ expect ( migrated . xpack . security . audit . appender . policy . kind ) . not . toBeDefined ( ) ;
113+ expect ( migrated . xpack . security . audit . appender . policy . type ) . toEqual ( 'time-interval' ) ;
114+ expect ( messages ) . toMatchInlineSnapshot ( `
115+ Array [
116+ "\\"xpack.security.audit.appender.policy.kind\\" is deprecated and has been replaced by \\"xpack.security.audit.appender.policy.type\\"",
117+ ]
118+ ` ) ;
119+ } ) ;
120+
121+ it ( 'renames audit.appender.policy.kind to audit.appender.policy.type' , ( ) => {
122+ const config = {
123+ xpack : {
124+ security : {
125+ audit : {
126+ appender : {
127+ strategy : { kind : 'numeric' } ,
128+ } ,
129+ } ,
130+ } ,
131+ } ,
132+ } ;
133+ const { messages, migrated } = applyConfigDeprecations ( cloneDeep ( config ) ) ;
134+ expect ( migrated . xpack . security . audit . appender . strategy . kind ) . not . toBeDefined ( ) ;
135+ expect ( migrated . xpack . security . audit . appender . strategy . type ) . toEqual ( 'numeric' ) ;
136+ expect ( messages ) . toMatchInlineSnapshot ( `
137+ Array [
138+ "\\"xpack.security.audit.appender.strategy.kind\\" is deprecated and has been replaced by \\"xpack.security.audit.appender.strategy.type\\"",
139+ ]
140+ ` ) ;
141+ } ) ;
142+
143+ it ( 'renames audit.appender.path to audit.appender.fileName' , ( ) => {
144+ const config = {
145+ xpack : {
146+ security : {
147+ audit : {
148+ appender : {
149+ type : 'file' ,
150+ path : './audit.log' ,
151+ } ,
152+ } ,
153+ } ,
154+ } ,
155+ } ;
156+ const { messages, migrated } = applyConfigDeprecations ( cloneDeep ( config ) ) ;
157+ expect ( migrated . xpack . security . audit . appender . path ) . not . toBeDefined ( ) ;
158+ expect ( migrated . xpack . security . audit . appender . fileName ) . toEqual ( './audit.log' ) ;
159+ expect ( messages ) . toMatchInlineSnapshot ( `
160+ Array [
161+ "\\"xpack.security.audit.appender.path\\" is deprecated and has been replaced by \\"xpack.security.audit.appender.fileName\\"",
162+ ]
163+ ` ) ;
164+ } ) ;
165+
55166 it ( `warns that 'authorization.legacyFallback.enabled' is unused` , ( ) => {
56167 const config = {
57168 xpack : {
0 commit comments