|
| 1 | +/* |
| 2 | +Copyright 2017 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package e2e |
| 18 | + |
| 19 | +import ( |
| 20 | + . "github.com/onsi/ginkgo" |
| 21 | + . "github.com/onsi/gomega/gexec" |
| 22 | +) |
| 23 | + |
| 24 | +// The actual test suite |
| 25 | +var _ = t.Describe("pull", func() { |
| 26 | + var ( |
| 27 | + endpoint, testDir string |
| 28 | + crio *Session |
| 29 | + ) |
| 30 | + BeforeEach(func() { |
| 31 | + endpoint, testDir, crio = t.StartCrio() |
| 32 | + }) |
| 33 | + |
| 34 | + AfterEach(func() { |
| 35 | + t.StopCrio(testDir, crio) |
| 36 | + }) |
| 37 | + |
| 38 | + const imageSuccessText = "Image is up to date" |
| 39 | + |
| 40 | + It("should succeed without tag or digest", func() { |
| 41 | + t.CrictlExpectSuccessWithEndpoint(endpoint, |
| 42 | + "pull gcr.io/cri-tools/test-image-1", |
| 43 | + imageSuccessText) |
| 44 | + }) |
| 45 | + |
| 46 | + It("should succeed with tag", func() { |
| 47 | + t.CrictlExpectSuccessWithEndpoint(endpoint, |
| 48 | + "pull gcr.io/cri-tools/test-image-1:latest", |
| 49 | + imageSuccessText) |
| 50 | + }) |
| 51 | + |
| 52 | + It("should succeed with digest", func() { |
| 53 | + t.CrictlExpectSuccessWithEndpoint(endpoint, |
| 54 | + "pull gcr.io/cri-tools/test-image-digest"+ |
| 55 | + "@sha256:9179135b4b4cc5a8721e09379244807553c318d92fa3111a65133241551ca343", |
| 56 | + imageSuccessText) |
| 57 | + }) |
| 58 | + |
| 59 | + It("should succeed to show the help", func() { |
| 60 | + t.CrictlExpectSuccess("pull -h", "Pull an image") |
| 61 | + }) |
| 62 | + |
| 63 | + It("should fail on not existing image", func() { |
| 64 | + t.CrictlExpectFailureWithEndpoint(endpoint, "pull localhost/wrong", |
| 65 | + "", "pulling image failed") |
| 66 | + }) |
| 67 | +}) |
0 commit comments