Merge pull request #25385 from crosbymichael/test-improvements
Test improvements to reduce time for long running tests
This commit is contained in:
commit
73c597e5f2
3 changed files with 18 additions and 32 deletions
|
@ -874,7 +874,7 @@ func (s *DockerSuite) TestContainerApiWait(c *check.C) {
|
|||
if daemonPlatform == "windows" {
|
||||
sleepCmd = "sleep"
|
||||
}
|
||||
dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "5")
|
||||
dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "2")
|
||||
|
||||
status, body, err := sockRequest("POST", "/containers/"+name+"/wait", nil)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/integration/checker"
|
||||
|
@ -89,7 +90,7 @@ func (s *DockerSuite) TestApiStatsNetworkStats(c *check.C) {
|
|||
|
||||
// Retrieve the container address
|
||||
contIP := findContainerIP(c, id, "bridge")
|
||||
numPings := 4
|
||||
numPings := 1
|
||||
|
||||
var preRxPackets uint64
|
||||
var preTxPackets uint64
|
||||
|
@ -145,18 +146,24 @@ func (s *DockerSuite) TestApiStatsNetworkStatsVersioning(c *check.C) {
|
|||
out, _ := runSleepingContainer(c)
|
||||
id := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(id), checker.IsNil)
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
for i := 17; i <= 21; i++ {
|
||||
apiVersion := fmt.Sprintf("v1.%d", i)
|
||||
statsJSONBlob := getVersionedStats(c, id, apiVersion)
|
||||
if versions.LessThan(apiVersion, "v1.21") {
|
||||
c.Assert(jsonBlobHasLTv121NetworkStats(statsJSONBlob), checker.Equals, true,
|
||||
check.Commentf("Stats JSON blob from API %s %#v does not look like a <v1.21 API stats structure", apiVersion, statsJSONBlob))
|
||||
} else {
|
||||
c.Assert(jsonBlobHasGTE121NetworkStats(statsJSONBlob), checker.Equals, true,
|
||||
check.Commentf("Stats JSON blob from API %s %#v does not look like a >=v1.21 API stats structure", apiVersion, statsJSONBlob))
|
||||
}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
apiVersion := fmt.Sprintf("v1.%d", i)
|
||||
statsJSONBlob := getVersionedStats(c, id, apiVersion)
|
||||
if versions.LessThan(apiVersion, "v1.21") {
|
||||
c.Assert(jsonBlobHasLTv121NetworkStats(statsJSONBlob), checker.Equals, true,
|
||||
check.Commentf("Stats JSON blob from API %s %#v does not look like a <v1.21 API stats structure", apiVersion, statsJSONBlob))
|
||||
} else {
|
||||
c.Assert(jsonBlobHasGTE121NetworkStats(statsJSONBlob), checker.Equals, true,
|
||||
check.Commentf("Stats JSON blob from API %s %#v does not look like a >=v1.21 API stats structure", apiVersion, statsJSONBlob))
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func getNetworkStats(c *check.C, id string) map[string]types.NetworkStats {
|
||||
|
|
|
@ -661,27 +661,6 @@ RUN ls -le /file`
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildSixtySteps(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux) // TODO Windows: This test passes on Windows,
|
||||
// but currently adds a disproportionate amount of time for the value it has.
|
||||
// Removing it from Windows CI for now, but this will be revisited in the
|
||||
// TP5 timeframe when perf is better.
|
||||
name := "foobuildsixtysteps"
|
||||
|
||||
ctx, err := fakeContext("FROM "+minimalBaseImage()+"\n"+strings.Repeat("ADD foo /\n", 60),
|
||||
map[string]string{
|
||||
"foo": "test1",
|
||||
})
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
defer ctx.Close()
|
||||
|
||||
if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAddSingleFileToRoot(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux) // Linux specific test
|
||||
name := "testaddimg"
|
||||
|
|
Loading…
Add table
Reference in a new issue