Skip to content

Commit

Permalink
Fix CLI tests
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Zunker <[email protected]>
  • Loading branch information
czunker committed Dec 5, 2023
1 parent 41fd303 commit b4d7ffd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
6 changes: 4 additions & 2 deletions test/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import (
"go.mondoo.com/cnspec/v9/apps/cnspec/cmd"
)

var once sync.Once
var cnspecCmd *cobra.Command
var (
once sync.Once
cnspecCmd *cobra.Command
)

func setup() {
var err error
Expand Down
8 changes: 4 additions & 4 deletions test/cli/testdata/cnspec.ct
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Available Commands:
logout Log out from Mondoo Platform.
migrate Migrate cnspec CLI configuration to the latest version.
providers Providers add connectivity to all assets.
run Run an MQL query.
scan Scan assets with one or more policies.
run Run a query with your local system
scan Scan your local system
serve Start cnspec in background mode.
shell Interactive query shell for MQL.
shell Interactive shell with your local system
status Verify access to Mondoo Platform.
vault Manage vault environments.
version Display the cnspec version.
vuln Scans a target for Vulnerabilities.
vuln Check for vulnerabilities your local system

Flags:
--api-proxy string Set proxy for communications with Mondoo API
Expand Down
34 changes: 33 additions & 1 deletion test/cli/testdata/cnspec_scan.ct
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,44 @@ To manually configure a policy, use this:
$ cnspec scan local -f bundle.mql.yaml --incognito

Usage:
cnspec scan [flags]
cnspec scan [command]

Available Commands:
mock Scan use a recording without an active connection
arista Scan an Arista EOS device
atlassian Scan Atlassian
aws Scan an AWS account
azure Scan an Azure subscription
container Scan a running container or container image
docker Scan a running Docker container or Docker image
equinix Scan an Equinix Metal organization
filesystem Scan a mounted file system target
gcp Scan a Google Cloud project
github Scan a GitHub organization or repository
gitlab Scan a GitLab group or project
google-workspace Scan a Google Workspace account
host Scan a remote host
ipmi Scan an IPMI interface
k8s Scan a Kubernetes cluster or local manifest file(s)
local Scan your local system
mock Scan use a recording without an active connection
ms365 Scan a Microsoft 365 account
oci Scan an Oracle Cloud Infrastructure tenancy
okta Scan Okta
opcua Scan an OPC UA device
slack Scan a Slack team
ssh Scan a remote system via SSH
terraform Scan a Terraform HCL file or directory
vagrant Scan a Vagrant host
vcd Scan a VMware Cloud Director installation
vsphere Scan a VMware vSphere installation
winrm Scan a remote system via WinRM

Flags:
--annotation stringToString Add an annotation to the asset. (default [])
--asset-name string User-override for the asset name
--detect-cicd Try to detect CI/CD environments. If detected, set the asset category to 'cicd'. (default true)
--discover strings Enable the discovery of nested assets. Supports: all,auto,container,container-images
-h, --help help for scan
--incognito Run in incognito mode. Do not report scan results to Mondoo Platform.
--inventory-ansible Set the inventory format to Ansible.
Expand All @@ -30,8 +59,11 @@ Flags:
--policy strings Lists policies to execute. This requires --policy-bundle. You can pass multiple policies using --policy POLICY.
-f, --policy-bundle strings Path to local policy file
--props stringToString Custom values for properties (default [])
--record string Record all resource calls and use resources in the recording
--score-threshold int If any score falls below the threshold, exit 1.
--share create a web-based private reports when cnspec is unauthenticated. Defaults to false.
--sudo Elevate privileges with sudo.
--use-recording string Use a recording to inject resource data (read-only)

Global Flags:
--api-proxy string Set proxy for communications with Mondoo API
Expand Down

0 comments on commit b4d7ffd

Please sign in to comment.