github.com/vmware/govmomi@v0.43.0/govc/test/vlcm.bats (about) 1 #!/usr/bin/env bats 2 3 load test_helper 4 5 location="http://127.0.0.1:9999/files/custom_driver.zip" 6 7 @test "vlcm.depot.offline.ls" { 8 vcsim_env 9 10 run govc vlcm.depot.offline.ls 11 assert_success 12 } 13 14 @test "vlcm.depot.offline.create" { 15 vcsim_env 16 17 run govc vlcm.depot.offline.create -l=$location -source-type=PULL 18 assert_success 19 20 depot=$(govc vlcm.depot.offline.ls | jq '."depot-1"') 21 l=$(echo $depot | jq -r '.location') 22 assert_equal $location $l 23 srcType=$(echo $depot | jq -r '."source_type"') 24 assert_equal "PULL" $srcType 25 } 26 27 @test "vlcm.depot.offline.info" { 28 vcsim_env 29 30 run govc vlcm.depot.offline.create -l=$location -source-type=PULL 31 assert_success "" 32 33 depot=$(govc vlcm.depot.offline.info -depot-id=depot-1) 34 comp=$(echo $depot | jq '."metadata_bundles"."dummy-content"[0]."independent_components"."dummy-component"') 35 name=$(echo $comp | jq -r '."display_name"') 36 assert_equal "DummyComponent" $name 37 version=$(echo $comp | jq -r '.versions[0].version') 38 displayVersion=$(echo $comp | jq -r '.versions[0]."display_version"') 39 assert_equal "1.0.0" $version 40 assert_equal "1.0.0" $displayVersion 41 } 42 43 @test "vlcm.depot.offline.rm" { 44 vcsim_env 45 46 run govc vlcm.depot.offline.create -l=$location -source-type=PULL 47 assert_success 48 49 run govc vlcm.depot.offline.rm -depot-id=depot-1 50 assert_success 51 52 run govc vlcm.depot.offline.info -depot-id=depot-1 53 assert_failure 54 assert_matches "404 Not Found" 55 } 56 57 @test "cluster.draft.ls" { 58 vcsim_env 59 60 run govc cluster.draft.ls -cluster-id=domain-c21 61 assert_success 62 } 63 64 @test "cluster.draft.create" { 65 vcsim_env 66 67 run govc cluster.draft.create -cluster-id=domain-c21 68 assert_success 69 70 draft=$(govc cluster.draft.ls -cluster-id=domain-c21 | jq '."1"') 71 assert_equal "" $(echo $draft | jq -r '.owner') 72 } 73 74 @test "cluster.draft.info" { 75 vcsim_env 76 77 run govc cluster.draft.create -cluster-id=domain-c21 78 assert_success 79 80 run govc cluster.draft.info -cluster-id=domain-c21 -draft-id=1 81 assert_success 82 } 83 84 @test "cluster.draft.rm" { 85 vcsim_env 86 87 run govc cluster.draft.create -cluster-id=domain-c21 88 assert_success 89 90 run govc cluster.draft.rm -cluster-id=domain-c21 -draft-id=1 91 92 run govc cluster.draft.info -cluster-id=domain-c21 -draft-id=1 93 assert_failure 94 assert_matches "404 Not Found" 95 } 96 97 @test "cluster.draft.commit" { 98 vcsim_env 99 100 run govc cluster.draft.create -cluster-id=domain-c21 101 assert_success 102 103 run govc cluster.draft.commit -cluster-id=domain-c21 -draft-id=1 104 105 run govc cluster.draft.info -cluster-id=domain-c21 -draft-id=1 106 assert_failure 107 assert_matches "404 Not Found" 108 } 109 110 @test "cluster.draft.component.ls" { 111 vcsim_env 112 113 run govc cluster.draft.create -cluster-id=domain-c21 114 assert_success 115 116 run govc cluster.draft.component.ls -cluster-id=domain-c21 -draft-id=1 117 assert_success 118 } 119 120 @test "cluster.draft.component.add" { 121 vcsim_env 122 123 run govc cluster.draft.create -cluster-id=domain-c21 124 assert_success 125 126 run govc cluster.draft.component.add -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id -component-version=1.2.3.4 127 assert_success 128 129 comp=$(govc cluster.draft.component.ls -cluster-id=domain-c21 -draft-id=1 | jq '."comp-id"') 130 assert_equal "1.2.3.4" $(echo $comp | jq -r '.version') 131 assert_equal "DummyComponent" $(echo $comp | jq -r '.details.display_name') 132 } 133 134 @test "cluster.draft.component.info" { 135 vcsim_env 136 137 run govc cluster.draft.create -cluster-id=domain-c21 138 assert_success 139 140 run govc cluster.draft.component.add -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id -component-version=1.2.3.4 141 assert_success 142 143 comp=$(govc cluster.draft.component.info -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id) 144 assert_equal "1.2.3.4" $(echo $comp | jq -r '.version') 145 assert_equal "DummyComponent" $(echo $comp | jq -r '.details.display_name') 146 run govc cluster.draft.component.info -cluster-id=domain-c21 -draft-id=1 -component-id=invalid-id 147 assert_failure 148 assert_matches "404 Not Found" 149 } 150 151 @test "cluster.draft.component.rm" { 152 vcsim_env 153 154 run govc cluster.draft.create -cluster-id=domain-c21 155 assert_success 156 157 run govc cluster.draft.component.add -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id -component-version=1.2.3.4 158 assert_success 159 160 run govc cluster.draft.component.rm -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id 161 162 run govc cluster.draft.component.info -cluster-id=domain-c21 -draft-id=1 -component-id=comp-id 163 assert_failure 164 assert_matches "404 Not Found" 165 } 166 167 @test "cluster.draft.baseimage.set" { 168 vcsim_env 169 170 run govc cluster.draft.create -cluster-id=domain-c21 171 assert_success 172 173 run govc cluster.draft.baseimage.set -cluster-id=domain-c21 -draft-id=1 -version=1.0.0 174 assert_success 175 176 baseimg=$(govc cluster.draft.baseimage.info -cluster-id=domain-c21 -draft-id=1) 177 178 assert_equal "1.0.0" $(echo $baseimg | jq -r '.version') 179 } 180 181 @test "cluster.vlcm.enable" { 182 vcsim_env 183 184 res=$(govc cluster.vlcm.info -cluster-id=domain-c21) 185 assert_equal "false" $(echo $res | jq -r '.enabled') 186 187 run govc cluster.vlcm.enable -cluster-id=domain-c21 188 189 res=$(govc cluster.vlcm.info -cluster-id=domain-c21) 190 assert_equal "true" $(echo $res | jq -r '.enabled') 191 }