From 844d540d042fe7477e62f8cf28e524fcd756f6c8 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Thu, 29 Oct 2020 14:27:36 -0400 Subject: Add tests for network aliases As part of this, we need two new functions, for retrieving all aliases for a network and removing all aliases for a network, both required to test. Also, rework handling for some things the tests discovered were broken (notably conflicts between container name and existing aliases). Signed-off-by: Matthew Heon --- libpod/state.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libpod/state.go') diff --git a/libpod/state.go b/libpod/state.go index 6b178ec58..183f773b5 100644 --- a/libpod/state.go +++ b/libpod/state.go @@ -106,6 +106,12 @@ type State interface { SetNetworkAliases(ctr *Container, network string, aliases []string) error // Remove network aliases for the given container in the given network. RemoveNetworkAliases(ctr *Container, network string) error + // GetAllAliasesForNetwork returns all the aliases for a given + // network. Returns a map of alias to container ID. + GetAllAliasesForNetwork(network string) (map[string]string, error) + // RemoveAllAliasesForNetwork removes all the aliases for a given + // network. + RemoveAllAliasesForNetwork(network string) error // Return a container config from the database by full ID GetContainerConfig(id string) (*ContainerConfig, error) -- cgit v1.2.3-54-g00ecf