-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2609 from alexandear/refactor/fuzz
Refactor fuzz tests
- Loading branch information
Showing
6 changed files
with
18 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
package cidata | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/lima-vm/lima/pkg/limayaml" | ||
"github.com/lima-vm/lima/pkg/networks" | ||
"github.com/lima-vm/lima/pkg/ptr" | ||
|
||
"github.com/lima-vm/lima/pkg/limayaml" | ||
) | ||
|
||
func FuzzSetupEnv(f *testing.F) { | ||
f.Fuzz(func(_ *testing.T, suffix string, localhost bool) { | ||
var prefix string | ||
prefix := "http://127.0.0.1:8080/" | ||
if localhost { | ||
prefix = "http://localhost:8080/" | ||
} else { | ||
prefix = "http://127.0.0.1:8080/" | ||
} | ||
envKey := "http_proxy" | ||
envValue := fmt.Sprintf("%s%s", prefix, suffix) | ||
templateArgs := TemplateArgs{SlirpGateway: networks.SlirpGateway} | ||
envAttr := map[string]string{envKey: envValue} | ||
_, _ = setupEnv(&limayaml.LimaYAML{PropagateProxyEnv: ptr.Of(false), Env: envAttr}, templateArgs) | ||
_, _ = setupEnv(&limayaml.LimaYAML{ | ||
PropagateProxyEnv: ptr.Of(false), | ||
Env: map[string]string{"http_proxy": prefix + suffix}, | ||
}, templateArgs) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters