Skip to content

Commit

Permalink
modify verbose from bool to int for level of verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Jun 26, 2024
1 parent 90b8a39 commit f76b4c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions provisioner/testinfra.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Config struct {
Sudo bool `mapstructure:"sudo" required:"false"`
SudoUser string `mapstructure:"sudo_user" required:"false"`
TestFiles []string `mapstructure:"test_files" required:"false"`
Verbose bool `mapstructure:"verbose" required:"false"`
Verbose int `mapstructure:"verbose" required:"false"`

ctx interpolate.Context
}
Expand Down Expand Up @@ -175,8 +175,8 @@ func (provisioner *Provisioner) Prepare(raws ...interface{}) error {
}

// verbose parameter
if provisioner.config.Verbose {
log.Print("pytest will execute with verbosity enabled")
if provisioner.config.Verbose > 0 {
log.Print("pytest will execute with verbose enabled at level %d", provisioner.config.Verbose)
}

// check if testinfra files are specified as inputs
Expand Down
4 changes: 2 additions & 2 deletions provisioner/testinfra.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions provisioner/testinfra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var basicConfig = &Config{
Sudo: true,
SudoUser: "fooman",
TestFiles: []string{"fixtures/test.py"},
Verbose: true,
Verbose: 1,
}

// test basic config for packer template/config data
Expand Down Expand Up @@ -98,8 +98,8 @@ func TestProvisionerPrepareMinimal(test *testing.T) {
test.Errorf("default empty setting for SudoUser is incorrect: %s", provisioner.config.SudoUser)
}

if provisioner.config.Verbose == true {
test.Errorf("default false setting for Verbose is incorrect: %t", provisioner.config.Verbose)
if provisioner.config.Verbose != 0 {
test.Errorf("default empty setting for Verbose is incorrect: %d", provisioner.config.Verbose)
}

if provisioner.config.PytestPath != "py.test" {
Expand Down

0 comments on commit f76b4c3

Please sign in to comment.