diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2020-12-01 22:12:16 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2020-12-02 10:27:00 +0100 |
commit | c31a5c0d9c9db52f03caa443a3fdfdce194046e8 (patch) | |
tree | fe21af9d8e5b87e6fa4054bb8d30ce17ab673662 /test/apiv2/35-networks.at | |
parent | 9c5fe954cca8b4bcb8f552645e1f52a5d9824134 (diff) | |
download | podman-c31a5c0d9c9db52f03caa443a3fdfdce194046e8.tar.gz podman-c31a5c0d9c9db52f03caa443a3fdfdce194046e8.tar.bz2 podman-c31a5c0d9c9db52f03caa443a3fdfdce194046e8.zip |
Add support for network ids
The network ID is not stored. It is just the sha256 hash from
the network name. There is a risk of a potential hash collision.
However it's very unlikely and even if we hit this it will
complain that more than network with this ID exists.
The main benefit is that the compat api can have proper
network ID support. Also this adds the support for
`podman network ls --format "{{.ID}}"` and `--filter id=<ID>`.
It also ensures that we can do network rm <ID> and network
inspect <ID>.
Since we use a hash this commit is backwards compatible even for
already existing networks.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'test/apiv2/35-networks.at')
-rw-r--r-- | test/apiv2/35-networks.at | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/apiv2/35-networks.at b/test/apiv2/35-networks.at index d9556d59f..0ce56ee3c 100644 --- a/test/apiv2/35-networks.at +++ b/test/apiv2/35-networks.at @@ -38,9 +38,19 @@ length=2 # filters={"label":["abc"]} t GET networks?filters=%7B%22label%22%3A%5B%22abc%22%5D%7D 200 \ length=1 -# invalid filter filters={"id":["abc"]} -t GET networks?filters=%7B%22id%22%3A%5B%22abc%22%5D%7D 500 \ -.cause='invalid filter "id"' +# id filter filters={"id":["a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1"]} +t GET networks?filters=%7B%22id%22%3A%5B%22a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1%22%5D%7D 200 \ +length=1 \ +.[0].Name=network1 \ +.[0].Id=a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 +# invalid filter filters={"dangling":["1"]} +t GET networks?filters=%7B%22dangling%22%3A%5B%221%22%5D%7D 500 \ +.cause='invalid filter "dangling"' + +# network inspect docker +t GET networks/a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 200 \ +.Name=network1 \ +.Id=a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 # clean the network t DELETE libpod/networks/network1 200 \ |