Skip to content

Commit 59e32d9

Browse files
committed
Minor smoke test followup
1 parent ff5745f commit 59e32d9

File tree

3 files changed

+62
-44
lines changed

3 files changed

+62
-44
lines changed

src/commands/manifest/cmd-manifest-cdxgen.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ async function run(
278278
yargv.lifecycle = 'pre-build'
279279
yargv['install-deps'] = false
280280
logger.info(
281-
`Socket set cdxgen --lifecycle to "${yargv.lifecycle}" to avoid arbitrary code execution on this scan.\n Pass "--lifecycle build" to generate a BOM consisting of information obtained during the build process.\n See cdxgen ${terminalLink(
281+
`Setting cdxgen --lifecycle to "${yargv.lifecycle}" to avoid arbitrary code execution on this scan.\n Pass "--lifecycle build" to generate a BOM consisting of information obtained during the build process.\n See cdxgen ${terminalLink(
282282
'BOM lifecycles documentation',
283283
'https://cyclonedx.github.io/cdxgen/#/ADVANCED?id=bom-lifecycles',
284284
)} for more details.\n`,

src/commands/organization/cmd-organization-policy-security.mts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@ async function run(
8585

8686
const wasValidInput = checkCommandInput(
8787
outputKind,
88-
{
89-
nook: true,
90-
test: !!orgSlug,
91-
message: 'Org name as the first argument',
92-
pass: 'ok',
93-
fail: 'missing',
94-
},
9588
{
9689
nook: true,
9790
test: !json || !markdown,

test/smoke.sh

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ restore_config() {
4747
echo -e "\n${YELLOW}Restoring backed up configuration values...${NC}"
4848
eval "${COMMAND_PREFIX} config set defaultOrg ${DEFORG_BAK}"
4949
eval "${COMMAND_PREFIX} config set apiToken ${TOKEN_BAK}"
50-
eval "${COMMAND_PREFIX} config set isTestingV1 ${TESTV1_BAK}"
5150
echo -e "${GREEN}Configuration restored!${NC}"
5251
}
5352

@@ -259,15 +258,11 @@ fi
259258
echo "Backing up default org and apitoken..."
260259
DEFORG_BAK=$(eval "$COMMAND_PREFIX config get defaultOrg --json" | jq -r '.data' )
261260
TOKEN_BAK=$(eval "$COMMAND_PREFIX config get apiToken --json" | jq -r '.data' )
262-
TESTV1_BAK=$(eval "$COMMAND_PREFIX config get isTestingV1 --json" | jq -r '.data' )
263261
echo "Backing complete!"
264262

265263
# Set up trap to restore config on any exit
266264
trap restore_config EXIT
267265

268-
# This smoke test assumes the <v1 cli api
269-
run_socket 0 config set isTestingV1 true
270-
271266
### Analytics
272267

273268
if should_run_section "analytics"; then
@@ -343,20 +338,20 @@ fi
343338
### dependencies
344339

345340
if should_run_section "dependencies"; then
346-
run_socket 0 dependencies
347-
run_socket 0 dependencies --help
348-
run_socket 0 dependencies --dry-run
349-
run_json 0 dependencies --json
350-
run_socket 0 dependencies --markdown
351-
352-
run_socket 0 dependencies --limit 1
353-
run_socket 0 dependencies --offset 5
354-
run_socket 0 dependencies --limit 1 --offset 10
355-
356-
#run_json 2 dependencies --json --wat foo
357-
run_json 0 dependencies --json --limit -200
358-
run_json 0 dependencies --json --limit NaN
359-
run_json 0 dependencies --json --limit foo
341+
run_socket 0 organization dependencies
342+
run_socket 0 organization dependencies --help
343+
run_socket 0 organization dependencies --dry-run
344+
run_json 0 organization dependencies --json
345+
run_socket 0 organization dependencies --markdown
346+
347+
run_socket 0 organization dependencies --limit 1
348+
run_socket 0 organization dependencies --offset 5
349+
run_socket 0 organization dependencies --limit 1 --offset 10
350+
351+
#run_json 2 organization dependencies --json --wat foo
352+
run_json 0 organization dependencies --json --limit -200
353+
run_json 0 organization dependencies --json --limit NaN
354+
run_json 0 organization dependencies --json --limit foo
360355
fi
361356

362357
### fix
@@ -404,27 +399,27 @@ if should_run_section "manifest"; then
404399
run_socket 2 manifest
405400
run_socket 0 manifest --help
406401
run_socket 0 manifest --dry-run
407-
run_socket 2 manifest auto
402+
run_socket 1 manifest auto
408403
run_socket 0 manifest auto --help
409404
run_socket 0 manifest auto --dry-run
410-
run_socket 2 manifest conda
405+
run_socket 1 manifest conda
411406
run_socket 0 manifest conda --help
412-
run_socket 2 manifest conda --dry-run
413-
run_socket 2 manifest gradle
407+
run_socket 0 manifest conda --dry-run
408+
run_socket 1 manifest gradle
414409
run_socket 0 manifest gradle --help
415-
run_socket 2 manifest gradle --dry-run
416-
run_socket 2 manifest kotlin
410+
run_socket 1 manifest gradle --dry-run
411+
run_socket 1 manifest kotlin
417412
run_socket 0 manifest kotlin --help
418-
run_socket 2 manifest kotlin --dry-run
419-
run_socket 2 manifest scala
413+
run_socket 0 manifest kotlin --dry-run
414+
run_socket 1 manifest scala
420415
run_socket 0 manifest scala --help
421-
run_socket 2 manifest scala --dry-run
416+
run_socket 0 manifest scala --dry-run
422417
fi
423418

424419
### npm
425420

426421
if should_run_section "npm"; then
427-
run_socket 1 npm
422+
run_socket 0 npm info
428423
run_socket 0 npm --help
429424
run_socket 0 npm --dry-run
430425
run_socket 0 npm info
@@ -433,7 +428,7 @@ fi
433428
### npx
434429

435430
if should_run_section "npx"; then
436-
run_socket 2 npx
431+
run_socket 0 npx cowsay moo
437432
run_socket 0 npx --help
438433
run_socket 0 npx --dry-run
439434
run_socket 0 npx socket --dry-run
@@ -452,14 +447,16 @@ fi
452447

453448
if should_run_section "optimize"; then
454449
run_socket 0 optimize
450+
run_socket 0 optimize --prod
451+
run_socket 0 optimize --pin
455452
run_socket 0 optimize --help
456453
run_socket 0 optimize --dry-run
457454
fi
458455

459456
### organization
460457

461458
if should_run_section "organization"; then
462-
run_socket 0 organization
459+
run_socket 2 organization
463460
run_socket 0 organization --help
464461
run_socket 0 organization --dry-run
465462
run_socket 0 organization list
@@ -495,9 +492,20 @@ if should_run_section "organization"; then
495492
run_json 1 organization policy license --org trash --json
496493
run_socket 0 organization policy license --org $DEFORG_BAK
497494

495+
echo ""
496+
echo ""
497+
echo "Clearing defaultOrg for next tests"
498498
eval "$COMMAND_PREFIX config unset defaultOrg"
499-
run_json 2 organization policy security --json --no-interactive
500-
run_json 2 organization policy license --json --no-interactive
499+
run_json 1 organization policy security --json --no-interactive
500+
run_json 1 organization policy license --json --no-interactive
501+
echo ""
502+
echo ""
503+
echo "Setting defaultOrg to an invalid org for the next tests"
504+
eval "$COMMAND_PREFIX config set defaultOrg fake_org"
505+
run_json 1 organization policy security --json --no-interactive
506+
run_json 1 organization policy license --json --no-interactive
507+
echo ""
508+
echo ""
501509
echo "Restoring default org to $DEFORG_BAK"
502510
eval "${COMMAND_PREFIX} config set defaultOrg $DEFORG_BAK"
503511
fi
@@ -548,7 +556,7 @@ fi
548556
### raw-npx
549557

550558
if should_run_section "raw-npx"; then
551-
run_socket 0 raw-npx # interactive shell...
559+
run_socket 0 raw-npx cowsay moo
552560
run_socket 0 raw-npx --help
553561
run_socket 0 raw-npx --dry-run
554562
run_socket 0 raw-npx socket --dry-run
@@ -577,18 +585,26 @@ if should_run_section "repos"; then
577585
run_socket 2 repos del --dry-run
578586
run_socket 0 repos del cli-smoke-test
579587

588+
echo ""
589+
echo ""
590+
echo "Clearing defaultOrg for next tests"
580591
eval "$COMMAND_PREFIX config unset defaultOrg"
581592
run_json 2 repos create 'cli_donotcreate' --json --no-interactive
582593
run_json 2 repos del 'cli_donotcreate' --json --no-interactive
583594
run_json 2 repos view 'cli_donotcreate' --json --no-interactive
584595
run_json 2 repos list --json --no-interactive
585596
run_json 2 repos update 'cli_donotcreate' --homepage evil --json --no-interactive
597+
echo ""
598+
echo ""
599+
echo "Setting defaultOrg to an invalid org for the next tests"
586600
eval "$COMMAND_PREFIX config set defaultOrg fake_org"
587601
run_json 1 repos create 'cli_donotcreate' --json
588602
run_json 1 repos del 'cli_donotcreate' --json
589603
run_json 1 repos view 'cli_donotcreate' --json
590604
run_json 1 repos list --json
591605
run_json 1 repos update 'cli_donotcreate' --homepage evil --json
606+
echo ""
607+
echo ""
592608
echo "Restoring default org to $DEFORG_BAK"
593609
eval "${COMMAND_PREFIX} config set defaultOrg $DEFORG_BAK"
594610
run_json 1 repos view 'cli_donotcreate' --json
@@ -653,18 +669,27 @@ if should_run_section "scan"; then
653669
run_json 1 scan metadata "$SBOM_ID" --org fake_org --json
654670
run_socket 1 scan diff "$SBOM_ID" "$SBOM_ID" --org fake_org
655671
run_json 1 scan diff "$SBOM_ID" "$SBOM_ID" --org fake_org --json
672+
673+
echo ""
674+
echo ""
675+
echo "Clearing defaultOrg for the next tests"
656676
eval "$COMMAND_PREFIX config unset defaultOrg"
657677
run_json 2 scan create . --json --no-interactive
658678
run_json 2 scan view "$SBOM_ID" --json --no-interactive
659679
run_json 2 scan report "$SBOM_ID" --json --no-interactive
660680
run_json 2 scan metadata "$SBOM_ID" --json --no-interactive
661681
run_json 2 scan diff "$SBOM_ID" "$SBOM_ID" --json --no-interactive
682+
echo ""
683+
echo ""
684+
echo "Setting defaultOrg to an invalid org for the next tests"
662685
eval "$COMMAND_PREFIX config set defaultOrg fake_org"
663686
run_json 1 scan create . --json
664687
run_json 1 scan view "$SBOM_ID" --json
665688
run_json 1 scan report "$SBOM_ID" --json
666689
run_json 1 scan metadata "$SBOM_ID" --json
667690
run_json 1 scan diff "$SBOM_ID" "$SBOM_ID" --json
691+
echo ""
692+
echo ""
668693
echo "Restoring default org to $DEFORG_BAK"
669694
eval "${COMMAND_PREFIX} config set defaultOrg $DEFORG_BAK"
670695
fi
@@ -687,8 +712,8 @@ if should_run_section "wrapper"; then
687712
run_socket 2 wrapper
688713
run_socket 0 wrapper --help
689714
run_socket 2 wrapper --dry-run
690-
run_socket 0 wrapper --enable
691-
run_socket 0 wrapper --disable
715+
run_socket 0 wrapper on
716+
run_socket 0 wrapper off
692717
fi
693718

694719
### The end

0 commit comments

Comments
 (0)