MCPcopy Index your code
hub / github.com/docker/cli / TestParseWithMacAddress

Function TestParseWithMacAddress

cli/command/container/opts_test.go:357–368  ·  view source on GitHub ↗

Simple parse with MacAddress validation

(t *testing.T)

Source from the content-addressed store, hash-verified

355
356// Simple parse with MacAddress validation
357func TestParseWithMacAddress(t *testing.T) {
358 invalidMacAddress := "--mac-address=invalidMacAddress"
359 validMacAddress := "--mac-address=92:d0:c6:0a:29:33"
360 if _, _, _, err := parseRun([]string{invalidMacAddress, "img", "cmd"}); err != nil && err.Error() != "invalidMacAddress is not a valid mac address" {
361 t.Fatalf("Expected an error with %v mac-address, got %v", invalidMacAddress, err)
362 }
363 _, hostConfig, nwConfig := mustParse(t, validMacAddress)
364 defaultNw := hostConfig.NetworkMode.NetworkName()
365 if nwConfig.EndpointsConfig[defaultNw].MacAddress.String() != "92:d0:c6:0a:29:33" {
366 t.Fatalf("Expected the default endpoint to have the MacAddress '92:d0:c6:0a:29:33' set, got '%v'", nwConfig.EndpointsConfig[defaultNw].MacAddress)
367 }
368}
369
370func TestRunFlagsParseWithMemory(t *testing.T) {
371 flags, _ := setupRunFlags()

Callers

nothing calls this directly

Calls 4

parseRunFunction · 0.85
mustParseFunction · 0.85
StringMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…