@@ -27,11 +27,13 @@ const bucketName = `nodejs-samples-livestream-test-${uniqueID}`;
27
27
const projectId = process . env . GCLOUD_PROJECT ;
28
28
const location = 'us-central1' ;
29
29
const 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 } ` ;
31
33
const channelId = `nodejs-test-livestream-channel-${ uniqueID } ` ;
32
- const channelIdProjectId = `projects/${ projectId } /locations/${ location } /channels/${ channelId } ` ;
34
+ const channelName = `projects/${ projectId } /locations/${ location } /channels/${ channelId } ` ;
33
35
const 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 } ` ;
35
37
const outputUri = `gs://${ bucketName } /test-output-channel/` ;
36
38
const cwd = path . join ( __dirname , '..' ) ;
37
39
@@ -108,30 +110,30 @@ describe('Input functions', () => {
108
110
`node createInput.js ${ projectId } ${ location } ${ inputId } ` ,
109
111
{ cwd}
110
112
) ;
111
- assert . ok ( output . includes ( inputNameProjectId ) ) ;
113
+ assert . ok ( output . includes ( inputName ) ) ;
112
114
} ) ;
113
115
114
116
it ( 'should show a list of inputs' , ( ) => {
115
117
const output = execSync ( `node listInputs.js ${ projectId } ${ location } ` , {
116
118
cwd,
117
119
} ) ;
118
- assert . ok ( output . includes ( inputNameProjectId ) ) ;
120
+ assert . ok ( output . includes ( inputName ) ) ;
119
121
} ) ;
120
122
121
123
it ( 'should update an input' , ( ) => {
122
124
const output = execSync (
123
125
`node updateInput.js ${ projectId } ${ location } ${ inputId } ` ,
124
126
{ cwd}
125
127
) ;
126
- assert . ok ( output . includes ( inputNameProjectId ) ) ;
128
+ assert . ok ( output . includes ( inputName ) ) ;
127
129
} ) ;
128
130
129
131
it ( 'should get an input' , ( ) => {
130
132
const output = execSync (
131
133
`node getInput.js ${ projectId } ${ location } ${ inputId } ` ,
132
134
{ cwd}
133
135
) ;
134
- assert . ok ( output . includes ( inputNameProjectId ) ) ;
136
+ assert . ok ( output . includes ( inputName ) ) ;
135
137
} ) ;
136
138
137
139
it ( 'should delete an input' , ( ) => {
@@ -149,7 +151,13 @@ describe('Channel functions', () => {
149
151
`node createInput.js ${ projectId } ${ location } ${ inputId } ` ,
150
152
{ cwd}
151
153
) ;
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 ) ) ;
153
161
} ) ;
154
162
155
163
after ( ( ) => {
@@ -158,37 +166,43 @@ describe('Channel functions', () => {
158
166
{ cwd}
159
167
) ;
160
168
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' ) ) ;
161
175
} ) ;
162
176
163
177
it ( 'should create a channel' , ( ) => {
164
178
const output = execSync (
165
179
`node createChannel.js ${ projectId } ${ location } ${ channelId } ${ inputId } ${ outputUri } ` ,
166
180
{ cwd}
167
181
) ;
168
- assert . ok ( output . includes ( channelIdProjectId ) ) ;
182
+ assert . ok ( output . includes ( channelName ) ) ;
169
183
} ) ;
170
184
171
185
it ( 'should show a list of channels' , ( ) => {
172
186
const output = execSync ( `node listChannels.js ${ projectId } ${ location } ` , {
173
187
cwd,
174
188
} ) ;
175
- assert . ok ( output . includes ( channelIdProjectId ) ) ;
189
+ assert . ok ( output . includes ( channelName ) ) ;
176
190
} ) ;
177
191
178
192
it ( 'should update an channel' , ( ) => {
179
193
const output = execSync (
180
194
`node updateChannel.js ${ projectId } ${ location } ${ channelId } ${ inputId } ` ,
181
195
{ cwd}
182
196
) ;
183
- assert . ok ( output . includes ( channelIdProjectId ) ) ;
197
+ assert . ok ( output . includes ( channelName ) ) ;
184
198
} ) ;
185
199
186
200
it ( 'should get an channel' , ( ) => {
187
201
const output = execSync (
188
202
`node getChannel.js ${ projectId } ${ location } ${ channelId } ` ,
189
203
{ cwd}
190
204
) ;
191
- assert . ok ( output . includes ( channelIdProjectId ) ) ;
205
+ assert . ok ( output . includes ( channelName ) ) ;
192
206
} ) ;
193
207
194
208
it ( 'should start a channel' , ( ) => {
@@ -214,6 +228,22 @@ describe('Channel functions', () => {
214
228
) ;
215
229
assert . ok ( output . includes ( 'Deleted channel' ) ) ;
216
230
} ) ;
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
+ } ) ;
217
247
} ) ;
218
248
219
249
describe ( 'Channel event functions' , ( ) => {
@@ -222,13 +252,13 @@ describe('Channel event functions', () => {
222
252
`node createInput.js ${ projectId } ${ location } ${ inputId } ` ,
223
253
{ cwd}
224
254
) ;
225
- assert . ok ( output . includes ( inputNameProjectId ) ) ;
255
+ assert . ok ( output . includes ( inputName ) ) ;
226
256
227
257
output = execSync (
228
258
`node createChannel.js ${ projectId } ${ location } ${ channelId } ${ inputId } ${ outputUri } ` ,
229
259
{ cwd}
230
260
) ;
231
- assert . ok ( output . includes ( channelIdProjectId ) ) ;
261
+ assert . ok ( output . includes ( channelName ) ) ;
232
262
233
263
output = execSync (
234
264
`node startChannel.js ${ projectId } ${ location } ${ channelId } ` ,
@@ -262,23 +292,23 @@ describe('Channel event functions', () => {
262
292
`node createChannelEvent.js ${ projectId } ${ location } ${ channelId } ${ eventId } ` ,
263
293
{ cwd}
264
294
) ;
265
- assert . ok ( output . includes ( eventIdProjectId ) ) ;
295
+ assert . ok ( output . includes ( eventName ) ) ;
266
296
} ) ;
267
297
268
298
it ( 'should show a list of channel events' , ( ) => {
269
299
const output = execSync (
270
300
`node listChannelEvents.js ${ projectId } ${ location } ${ channelId } ` ,
271
301
{ cwd}
272
302
) ;
273
- assert . ok ( output . includes ( eventIdProjectId ) ) ;
303
+ assert . ok ( output . includes ( eventName ) ) ;
274
304
} ) ;
275
305
276
306
it ( 'should get a channel event' , ( ) => {
277
307
const output = execSync (
278
308
`node getChannelEvent.js ${ projectId } ${ location } ${ channelId } ${ eventId } ` ,
279
309
{ cwd}
280
310
) ;
281
- assert . ok ( output . includes ( eventIdProjectId ) ) ;
311
+ assert . ok ( output . includes ( eventName ) ) ;
282
312
} ) ;
283
313
284
314
it ( 'should delete a channel event' , ( ) => {
0 commit comments