Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 303135a

Browse files
committed
Move and remove e2e methods
Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
1 parent 4eba2d7 commit 303135a

3 files changed

Lines changed: 8 additions & 51 deletions

File tree

Gopkg.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/helper_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ func readFile(t *testing.T, path string) string {
2525
return strings.Replace(string(content), "\r", "", -1)
2626
}
2727

28+
type dindSwarmAndRegistryInfo struct {
29+
swarmAddress string
30+
registryAddress string
31+
configuredCmd icmd.Cmd
32+
stopRegistry func()
33+
registryLogs func() string
34+
}
35+
2836
func runWithDindSwarmAndRegistry(t *testing.T, todo func(dindSwarmAndRegistryInfo)) {
2937
cmd, cleanup := dockerCli.createTestCmd()
3038
defer cleanup()

e2e/pushpull_test.go

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
package e2e
22

33
import (
4-
"encoding/json"
54
"fmt"
6-
"io/ioutil"
7-
"net/http"
85
"path/filepath"
96
"strings"
107
"testing"
118

12-
"github.com/docker/cnab-to-oci/converter"
13-
"github.com/opencontainers/go-digest"
14-
v1 "github.com/opencontainers/image-spec/specs-go/v1"
159
"gotest.tools/assert"
1610
"gotest.tools/assert/cmp"
1711
"gotest.tools/icmd"
1812
)
1913

20-
type dindSwarmAndRegistryInfo struct {
21-
swarmAddress string
22-
registryAddress string
23-
configuredCmd icmd.Cmd
24-
stopRegistry func()
25-
registryLogs func() string
26-
}
27-
2814
func TestPushInsecureRegistry(t *testing.T) {
2915
runWithDindSwarmAndRegistry(t, func(info dindSwarmAndRegistryInfo) {
3016
ref := info.registryAddress + "/test/push-insecure"
@@ -172,39 +158,3 @@ func TestPushInstallBundle(t *testing.T) {
172158
})
173159
})
174160
}
175-
176-
func httpGet(url string, headers map[string]string, obj interface{}) error {
177-
client := &http.Client{}
178-
req, err := http.NewRequest("GET", url, nil)
179-
if err != nil {
180-
return err
181-
}
182-
for k, v := range headers {
183-
req.Header.Set(k, v)
184-
}
185-
r, err := client.Do(req)
186-
if err != nil {
187-
return err
188-
}
189-
defer r.Body.Close()
190-
if r.StatusCode != http.StatusOK {
191-
body, err := ioutil.ReadAll(r.Body)
192-
if err != nil {
193-
return err
194-
}
195-
return fmt.Errorf("unexpected http error code %d with message %s", r.StatusCode, string(body))
196-
}
197-
if err := json.NewDecoder(r.Body).Decode(obj); err != nil {
198-
return err
199-
}
200-
return nil
201-
}
202-
203-
func getManifestListDigest(index v1.Index) (digest.Digest, error) {
204-
for _, m := range index.Manifests {
205-
if m.Annotations[converter.CNABDescriptorTypeAnnotation] == "component" {
206-
return m.Digest, nil
207-
}
208-
}
209-
return "", fmt.Errorf("Service image not found")
210-
}

0 commit comments

Comments
 (0)