@@ -27,11 +27,13 @@ const bucketName = `nodejs-samples-livestream-test-${uniqueID}`;
2727const projectId = process . env . GCLOUD_PROJECT ;
2828const location = 'us-central1' ;
2929const inputId = `nodejs-test-livestream-input-${ uniqueID } ` ;
30- const inputNameProjectId = `projects/${ projectId } /locations/${ location } /inputs/${ inputId } ` ;
30+ const inputName = `projects/${ projectId } /locations/${ location } /inputs/${ inputId } ` ;
31+ const backupInputId = `nodejs-test-livestream-backup-input-${ uniqueID } ` ;
32+ const backupInputName = `projects/${ projectId } /locations/${ location } /inputs/${ backupInputId } ` ;
3133const channelId = `nodejs-test-livestream-channel-${ uniqueID } ` ;
32- const channelIdProjectId = `projects/${ projectId } /locations/${ location } /channels/${ channelId } ` ;
34+ const channelName = `projects/${ projectId } /locations/${ location } /channels/${ channelId } ` ;
3335const eventId = `nodejs-test-livestream-event-${ uniqueID } ` ;
34- const eventIdProjectId = `projects/${ projectId } /locations/${ location } /channels/${ channelId } /events/${ eventId } ` ;
36+ const eventName = `projects/${ projectId } /locations/${ location } /channels/${ channelId } /events/${ eventId } ` ;
3537const outputUri = `gs://${ bucketName } /test-output-channel/` ;
3638const cwd = path . join ( __dirname , '..' ) ;
3739
@@ -108,30 +110,30 @@ describe('Input functions', () => {
108110 `node createInput.js ${ projectId } ${ location } ${ inputId } ` ,
109111 { cwd}
110112 ) ;
111- assert . ok ( output . includes ( inputNameProjectId ) ) ;
113+ assert . ok ( output . includes ( inputName ) ) ;
112114 } ) ;
113115
114116 it ( 'should show a list of inputs' , ( ) => {
115117 const output = execSync ( `node listInputs.js ${ projectId } ${ location } ` , {
116118 cwd,
117119 } ) ;
118- assert . ok ( output . includes ( inputNameProjectId ) ) ;
120+ assert . ok ( output . includes ( inputName ) ) ;
119121 } ) ;
120122
121123 it ( 'should update an input' , ( ) => {
122124 const output = execSync (
123125 `node updateInput.js ${ projectId } ${ location } ${ inputId } ` ,
124126 { cwd}
125127 ) ;
126- assert . ok ( output . includes ( inputNameProjectId ) ) ;
128+ assert . ok ( output . includes ( inputName ) ) ;
127129 } ) ;
128130
129131 it ( 'should get an input' , ( ) => {
130132 const output = execSync (
131133 `node getInput.js ${ projectId } ${ location } ${ inputId } ` ,
132134 { cwd}
133135 ) ;
134- assert . ok ( output . includes ( inputNameProjectId ) ) ;
136+ assert . ok ( output . includes ( inputName ) ) ;
135137 } ) ;
136138
137139 it ( 'should delete an input' , ( ) => {
@@ -149,7 +151,13 @@ describe('Channel functions', () => {
149151 `node createInput.js ${ projectId } ${ location } ${ inputId } ` ,
150152 { cwd}
151153 ) ;
152- assert . ok ( output . includes ( inputNameProjectId ) ) ;
154+ assert . ok ( output . includes ( inputName ) ) ;
155+
156+ const output2 = execSync (
157+ `node createInput.js ${ projectId } ${ location } ${ backupInputId } ` ,
158+ { cwd}
159+ ) ;
160+ assert . ok ( output2 . includes ( backupInputName ) ) ;
153161 } ) ;
154162
155163 after ( ( ) => {
@@ -158,37 +166,43 @@ describe('Channel functions', () => {
158166 { cwd}
159167 ) ;
160168 assert . ok ( output . includes ( 'Deleted input' ) ) ;
169+
170+ const output2 = execSync (
171+ `node deleteInput.js ${ projectId } ${ location } ${ backupInputId } ` ,
172+ { cwd}
173+ ) ;
174+ assert . ok ( output2 . includes ( 'Deleted input' ) ) ;
161175 } ) ;
162176
163177 it ( 'should create a channel' , ( ) => {
164178 const output = execSync (
165179 `node createChannel.js ${ projectId } ${ location } ${ channelId } ${ inputId } ${ outputUri } ` ,
166180 { cwd}
167181 ) ;
168- assert . ok ( output . includes ( channelIdProjectId ) ) ;
182+ assert . ok ( output . includes ( channelName ) ) ;
169183 } ) ;
170184
171185 it ( 'should show a list of channels' , ( ) => {
172186 const output = execSync ( `node listChannels.js ${ projectId } ${ location } ` , {
173187 cwd,
174188 } ) ;
175- assert . ok ( output . includes ( channelIdProjectId ) ) ;
189+ assert . ok ( output . includes ( channelName ) ) ;
176190 } ) ;
177191
178192 it ( 'should update an channel' , ( ) => {
179193 const output = execSync (
180194 `node updateChannel.js ${ projectId } ${ location } ${ channelId } ${ inputId } ` ,
181195 { cwd}
182196 ) ;
183- assert . ok ( output . includes ( channelIdProjectId ) ) ;
197+ assert . ok ( output . includes ( channelName ) ) ;
184198 } ) ;
185199
186200 it ( 'should get an channel' , ( ) => {
187201 const output = execSync (
188202 `node getChannel.js ${ projectId } ${ location } ${ channelId } ` ,
189203 { cwd}
190204 ) ;
191- assert . ok ( output . includes ( channelIdProjectId ) ) ;
205+ assert . ok ( output . includes ( channelName ) ) ;
192206 } ) ;
193207
194208 it ( 'should start a channel' , ( ) => {
@@ -214,6 +228,22 @@ describe('Channel functions', () => {
214228 ) ;
215229 assert . ok ( output . includes ( 'Deleted channel' ) ) ;
216230 } ) ;
231+
232+ it ( 'should create a channel with backup input' , ( ) => {
233+ const output = execSync (
234+ `node createChannelWithBackupInput.js ${ projectId } ${ location } ${ channelId } ${ inputId } ${ backupInputId } ${ outputUri } ` ,
235+ { cwd}
236+ ) ;
237+ assert . ok ( output . includes ( channelName ) ) ;
238+ } ) ;
239+
240+ it ( 'should delete a channel with backup input' , ( ) => {
241+ const output = execSync (
242+ `node deleteChannel.js ${ projectId } ${ location } ${ channelId } ` ,
243+ { cwd}
244+ ) ;
245+ assert . ok ( output . includes ( 'Deleted channel' ) ) ;
246+ } ) ;
217247} ) ;
218248
219249describe ( 'Channel event functions' , ( ) => {
@@ -222,13 +252,13 @@ describe('Channel event functions', () => {
222252 `node createInput.js ${ projectId } ${ location } ${ inputId } ` ,
223253 { cwd}
224254 ) ;
225- assert . ok ( output . includes ( inputNameProjectId ) ) ;
255+ assert . ok ( output . includes ( inputName ) ) ;
226256
227257 output = execSync (
228258 `node createChannel.js ${ projectId } ${ location } ${ channelId } ${ inputId } ${ outputUri } ` ,
229259 { cwd}
230260 ) ;
231- assert . ok ( output . includes ( channelIdProjectId ) ) ;
261+ assert . ok ( output . includes ( channelName ) ) ;
232262
233263 output = execSync (
234264 `node startChannel.js ${ projectId } ${ location } ${ channelId } ` ,
@@ -262,23 +292,23 @@ describe('Channel event functions', () => {
262292 `node createChannelEvent.js ${ projectId } ${ location } ${ channelId } ${ eventId } ` ,
263293 { cwd}
264294 ) ;
265- assert . ok ( output . includes ( eventIdProjectId ) ) ;
295+ assert . ok ( output . includes ( eventName ) ) ;
266296 } ) ;
267297
268298 it ( 'should show a list of channel events' , ( ) => {
269299 const output = execSync (
270300 `node listChannelEvents.js ${ projectId } ${ location } ${ channelId } ` ,
271301 { cwd}
272302 ) ;
273- assert . ok ( output . includes ( eventIdProjectId ) ) ;
303+ assert . ok ( output . includes ( eventName ) ) ;
274304 } ) ;
275305
276306 it ( 'should get a channel event' , ( ) => {
277307 const output = execSync (
278308 `node getChannelEvent.js ${ projectId } ${ location } ${ channelId } ${ eventId } ` ,
279309 { cwd}
280310 ) ;
281- assert . ok ( output . includes ( eventIdProjectId ) ) ;
311+ assert . ok ( output . includes ( eventName ) ) ;
282312 } ) ;
283313
284314 it ( 'should delete a channel event' , ( ) => {
0 commit comments