summaryrefslogtreecommitdiff
path: root/test/apiv2/35-networks.at
blob: 4c032c072fc94286cbace8673f237249aab32593 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- sh -*-
#
# network-related tests
#

t GET networks/non-existing-network 404 \
  .cause='network not found'

if root; then
  t POST libpod/networks/create?name=network1 '' 200 \
    .Filename~.*/network1\\.conflist

  # --data '{"Subnet":{"IP":"10.10.254.0","Mask":[255,255,255,0]}}'
  t POST libpod/networks/create?name=network2 '"Subnet":{"IP":"10.10.254.0","Mask":[255,255,255,0]}' 200 \
    .Filename~.*/network2\\.conflist

  # test for empty mask
  t POST libpod/networks/create '"Subnet":{"IP":"10.10.1.0","Mask":[]}' 500 \
    .cause~'.*cannot be empty'
  # test for invalid mask
  t POST libpod/networks/create '"Subnet":{"IP":"10.10.1.0","Mask":[0,255,255,0]}' 500 \
    .cause~'.*mask is invalid'

  # clean the network
  t DELETE libpod/networks/network1 200 \
    .[0].Name~network1 \
    .[0].Err=null
  t DELETE libpod/networks/network2 200 \
    .[0].Name~network2 \
    .[0].Err=null

fi

# vim: filetype=sh