ae5b800085
This PR splits up the nomad/mock package into more files. Specific features that have a lot of mocks get their own file (e.g. acl, variables, csi, connect, etc.). Above that, functions that return jobs/allocs/nodes are in the job/alloc/node file. And lastly other mocks/helpers are in mock.go
32 lines
783 B
Go
32 lines
783 B
Go
package mock
|
|
|
|
import (
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
)
|
|
|
|
// NetworkStatus is a mock implementation of structs.NetworkStatus
|
|
type NetworkStatus struct {
|
|
address string
|
|
}
|
|
|
|
// NewNetworkStatus creates a mock NetworkStatus based on address.
|
|
func NewNetworkStatus(address string) structs.NetworkStatus {
|
|
return &NetworkStatus{address: address}
|
|
}
|
|
|
|
func (ns *NetworkStatus) NetworkStatus() *structs.AllocNetworkStatus {
|
|
return &structs.AllocNetworkStatus{Address: ns.address}
|
|
}
|
|
|
|
func AllocNetworkStatus() *structs.AllocNetworkStatus {
|
|
return &structs.AllocNetworkStatus{
|
|
InterfaceName: "eth0",
|
|
Address: "192.168.0.100",
|
|
DNS: &structs.DNSConfig{
|
|
Servers: []string{"1.1.1.1"},
|
|
Searches: []string{"localdomain"},
|
|
Options: []string{"ndots:5"},
|
|
},
|
|
}
|
|
}
|