@@ -16,6 +16,7 @@ const baseInput: StepListInput = {
1616 sourceBucketName : 'src-bucket' ,
1717 targetBucketName : 'target-bucket' ,
1818 destinationAccountName : 'dest-account' ,
19+ isManagementNetwork : true ,
1920} ;
2021
2122const noProgress : StepStateSources = { configuratorEvents : [ ] , chainStatusById : { } } ;
@@ -34,7 +35,6 @@ describe('buildStepViews', () => {
3435 it ( 'lists the full provisioning sequence in order when the user creates a new source account and a replication rule' , ( ) => {
3536 const views = buildStepViews ( baseInput , noProgress ) ;
3637 expect ( views . map ( ( v ) => v . id ) ) . toEqual ( [
37- 'import-destination-certificate' ,
3838 'create-source-account' ,
3939 'create-source-bucket' ,
4040 'create-account' ,
@@ -44,17 +44,24 @@ describe('buildStepViews', () => {
4444 'create-role' ,
4545 'attach-role-policy' ,
4646 'create-bucket' ,
47+ 'register-endpoint' ,
48+ 'configure-source-dns' ,
49+ 'import-destination-certificate' ,
4750 'create-location' ,
4851 'create-replication-rule' ,
4952 ] ) ;
5053 } ) ;
5154
5255 it ( 'numbers the steps and shows the chosen source and destination account names' , ( ) => {
53- const [ first , sourceAcc , sourceBkt , destAcc ] = buildStepViews ( baseInput , noProgress ) ;
54- expect ( first ) . toMatchObject ( { step : 1 , label : 'Import Destination Certificate' } ) ;
55- expect ( sourceAcc ) . toMatchObject ( { step : 2 , label : 'Create Account on Source: src-account' } ) ;
56- expect ( sourceBkt ) . toMatchObject ( { step : 3 , label : 'Create Bucket on Source: src-bucket' } ) ;
57- expect ( destAcc ) . toMatchObject ( { step : 4 , label : 'Create Account on Destination: dest-account' } ) ;
56+ const views = buildStepViews ( baseInput , noProgress ) ;
57+ const [ sourceAcc , sourceBkt , destAcc ] = views ;
58+ expect ( sourceAcc ) . toMatchObject ( { step : 1 , label : 'Create Account on Source: src-account' } ) ;
59+ expect ( sourceBkt ) . toMatchObject ( { step : 2 , label : 'Create Bucket on Source: src-bucket' } ) ;
60+ expect ( destAcc ) . toMatchObject ( { step : 3 , label : 'Create Account on Destination: dest-account' } ) ;
61+ expect ( views . find ( ( v ) => v . id === 'import-destination-certificate' ) ) . toMatchObject ( {
62+ step : 12 ,
63+ label : 'Import Certificate into Truststore' ,
64+ } ) ;
5865 } ) ;
5966
6067 it ( 'labels the destination IAM chain and the target bucket per the ARTESCA CRR procedure' , ( ) => {
@@ -65,6 +72,8 @@ describe('buildStepViews', () => {
6572 expect ( labels ) . toContain ( 'Create IAM Role' ) ;
6673 expect ( labels ) . toContain ( 'Attach Policy to Role' ) ;
6774 expect ( labels ) . toContain ( 'Create Target Bucket: target-bucket' ) ;
75+ expect ( labels ) . toContain ( 'Register Destination S3 Endpoint' ) ;
76+ expect ( labels ) . toContain ( 'Configure Source DNS Resolution' ) ;
6877 expect ( labels ) . toContain ( 'Create Location' ) ;
6978 expect ( labels ) . toContain ( 'Create Replication Rule' ) ;
7079 } ) ;
@@ -81,6 +90,12 @@ describe('buildStepViews', () => {
8190 expect ( views . find ( ( v ) => v . id === 'create-replication-rule' ) ) . toBeUndefined ( ) ;
8291 } ) ;
8392
93+ it ( 'drops the endpoint and DNS steps in data-network mode' , ( ) => {
94+ const views = buildStepViews ( { ...baseInput , isManagementNetwork : false } , noProgress ) ;
95+ expect ( views . find ( ( v ) => v . id === 'register-endpoint' ) ) . toBeUndefined ( ) ;
96+ expect ( views . find ( ( v ) => v . id === 'configure-source-dns' ) ) . toBeUndefined ( ) ;
97+ } ) ;
98+
8499 it ( 'shows every step as pending before anything runs' , ( ) => {
85100 expect ( buildStepViews ( baseInput , noProgress ) . every ( ( v ) => v . state === 'pending' ) ) . toBe ( true ) ;
86101 } ) ;
@@ -149,6 +164,35 @@ describe('buildStepViews — wizard-run rows', () => {
149164 } ) ;
150165} ) ;
151166
167+ describe ( 'buildStepViews — active flag' , ( ) => {
168+ it ( 'marks a wizard row active only while its link is running' , ( ) => {
169+ const running = buildStepViews ( baseInput , withChain ( { 'create-location' : { status : 'pending' } } ) ) ;
170+ expect ( running . find ( ( v ) => v . id === 'create-location' ) ) . toMatchObject ( { state : 'pending' , active : true } ) ;
171+ } ) ;
172+
173+ it ( 'does not mark a wizard row active before it starts or after it succeeds' , ( ) => {
174+ const idle = buildStepViews ( baseInput , noProgress ) ;
175+ expect ( idle . find ( ( v ) => v . id === 'create-location' ) ) . toMatchObject ( { state : 'pending' , active : false } ) ;
176+
177+ const done = buildStepViews ( baseInput , withChain ( { 'create-location' : { status : 'success' } } ) ) ;
178+ expect ( done . find ( ( v ) => v . id === 'create-location' ) ?. active ) . toBe ( false ) ;
179+ } ) ;
180+
181+ it ( 'marks a configurator row active between its started and completed events' , ( ) => {
182+ const started = buildStepViews ( baseInput , withEvents ( [ { event : 'step.started' , step : 'create-user' , at : 't' } ] ) ) ;
183+ expect ( started . find ( ( v ) => v . id === 'create-user' ) ) . toMatchObject ( { state : 'pending' , active : true } ) ;
184+
185+ const completed = buildStepViews (
186+ baseInput ,
187+ withEvents ( [
188+ { event : 'step.started' , step : 'create-user' , at : 't' } ,
189+ { event : 'step.completed' , step : 'create-user' , at : 't' } ,
190+ ] ) ,
191+ ) ;
192+ expect ( completed . find ( ( v ) => v . id === 'create-user' ) ) . toMatchObject ( { state : 'succeeded' , active : false } ) ;
193+ } ) ;
194+ } ) ;
195+
152196describe ( 'buildStepViews — crr-configurator rows' , ( ) => {
153197 it ( 'marks a configurator step done once it completes and shows the reason when one fails' , ( ) => {
154198 const events : SetupEvent [ ] = [
@@ -167,6 +211,29 @@ describe('buildStepViews — crr-configurator rows', () => {
167211 expect ( failed ?. errorMessage ) . toBe ( 'IAM refused CreateUser: entity already exists' ) ;
168212 } ) ;
169213
214+ it ( 'drives the management-network endpoint and DNS rows from their stream events' , ( ) => {
215+ const succeeded = buildStepViews (
216+ baseInput ,
217+ withEvents ( [ { event : 'step.completed' , step : 'register-endpoint' , at : 't' } ] ) ,
218+ ) ;
219+ expect ( succeeded . find ( ( v ) => v . id === 'register-endpoint' ) ?. state ) . toBe ( 'succeeded' ) ;
220+
221+ const failed = buildStepViews (
222+ baseInput ,
223+ withEvents ( [
224+ {
225+ event : 'step.failed' ,
226+ step : 'configure-source-dns' ,
227+ at : 't' ,
228+ error : { code : 'InternalError' , message : 'source could not resolve the endpoint' } ,
229+ } ,
230+ ] ) ,
231+ ) ;
232+ const dns = failed . find ( ( v ) => v . id === 'configure-source-dns' ) ;
233+ expect ( dns ?. state ) . toBe ( 'failed' ) ;
234+ expect ( dns ?. errorMessage ) . toBe ( 'source could not resolve the endpoint' ) ;
235+ } ) ;
236+
170237 it ( 'blames the first pending configurator row when the stream fails without pinning a step' , ( ) => {
171238 const views = buildStepViews ( baseInput , {
172239 configuratorEvents : [ ] ,
@@ -234,6 +301,8 @@ describe('allSucceeded / hasFailure', () => {
234301 'create-role' ,
235302 'attach-role-policy' ,
236303 'create-bucket' ,
304+ 'register-endpoint' ,
305+ 'configure-source-dns' ,
237306 ] . map ( ( step ) => ( { event : 'step.completed' , step, at : 't' } ) as SetupEvent ) ,
238307 chainStatusById : {
239308 'import-destination-certificate' : { status : 'success' } ,
0 commit comments