mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-10 18:56:55 +02:00
fix(docker): host network_mode port selection
This commit is contained in:
@@ -41,3 +41,38 @@ func TestContainerExplicit(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestContainerHostNetworkMode(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
container *container.SummaryTrimmed
|
||||
isHostNetworkMode bool
|
||||
}{
|
||||
{
|
||||
name: "host network mode",
|
||||
container: &container.SummaryTrimmed{
|
||||
Names: []string{"test"},
|
||||
State: "test",
|
||||
HostConfig: struct {
|
||||
NetworkMode string "json:\",omitempty\""
|
||||
}{
|
||||
NetworkMode: "host",
|
||||
},
|
||||
},
|
||||
isHostNetworkMode: true,
|
||||
},
|
||||
{
|
||||
name: "not host network mode",
|
||||
container: &container.SummaryTrimmed{
|
||||
Names: []string{"test"},
|
||||
State: "test",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := FromDocker(tt.container, "")
|
||||
ExpectEqual(t, c.IsHostNetworkMode, tt.isHostNetworkMode)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user