mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #12537 from hqhq/hq_remove_unused_function
remove unused function in server_unit_test.go
This commit is contained in:
commit
b5584ec24a
1 changed files with 0 additions and 47 deletions
|
@ -1,7 +1,6 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -10,7 +9,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
"github.com/docker/docker/engine"
|
"github.com/docker/docker/engine"
|
||||||
"github.com/docker/docker/pkg/version"
|
"github.com/docker/docker/pkg/version"
|
||||||
)
|
)
|
||||||
|
@ -133,53 +131,8 @@ func readEnv(src io.Reader, t *testing.T) *engine.Env {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func toJson(data interface{}, t *testing.T) io.Reader {
|
|
||||||
var buf bytes.Buffer
|
|
||||||
if err := json.NewEncoder(&buf).Encode(data); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
return &buf
|
|
||||||
}
|
|
||||||
|
|
||||||
func assertContentType(recorder *httptest.ResponseRecorder, contentType string, t *testing.T) {
|
func assertContentType(recorder *httptest.ResponseRecorder, contentType string, t *testing.T) {
|
||||||
if recorder.HeaderMap.Get("Content-Type") != contentType {
|
if recorder.HeaderMap.Get("Content-Type") != contentType {
|
||||||
t.Fatalf("%#v\n", recorder)
|
t.Fatalf("%#v\n", recorder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: Duplicated from integration/utils_test.go, but maybe that's OK as that
|
|
||||||
// should die as soon as we converted all integration tests?
|
|
||||||
// assertHttpNotError expect the given response to not have an error.
|
|
||||||
// Otherwise the it causes the test to fail.
|
|
||||||
func assertHttpNotError(r *httptest.ResponseRecorder, t *testing.T) {
|
|
||||||
// Non-error http status are [200, 400)
|
|
||||||
if r.Code < http.StatusOK || r.Code >= http.StatusBadRequest {
|
|
||||||
t.Fatal(fmt.Errorf("Unexpected http error: %v", r.Code))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func createEnvFromGetImagesJSONStruct(data getImagesJSONStruct) types.Image {
|
|
||||||
return types.Image{
|
|
||||||
RepoTags: data.RepoTags,
|
|
||||||
ID: data.Id,
|
|
||||||
Created: int(data.Created),
|
|
||||||
Size: int(data.Size),
|
|
||||||
VirtualSize: int(data.VirtualSize),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type getImagesJSONStruct struct {
|
|
||||||
RepoTags []string
|
|
||||||
Id string
|
|
||||||
Created int64
|
|
||||||
Size int64
|
|
||||||
VirtualSize int64
|
|
||||||
}
|
|
||||||
|
|
||||||
var sampleImage getImagesJSONStruct = getImagesJSONStruct{
|
|
||||||
RepoTags: []string{"test-name:test-tag"},
|
|
||||||
Id: "ID",
|
|
||||||
Created: 999,
|
|
||||||
Size: 777,
|
|
||||||
VirtualSize: 666,
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue