info_linux_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //go:build !windows
  2. package system // import "github.com/docker/docker/integration/system"
  3. import (
  4. "net/http"
  5. "testing"
  6. "github.com/docker/docker/testutil"
  7. req "github.com/docker/docker/testutil/request"
  8. "gotest.tools/v3/assert"
  9. is "gotest.tools/v3/assert/cmp"
  10. )
  11. func TestInfoBinaryCommits(t *testing.T) {
  12. ctx := setupTest(t)
  13. client := testEnv.APIClient()
  14. info, err := client.Info(ctx)
  15. assert.NilError(t, err)
  16. assert.Check(t, "N/A" != info.ContainerdCommit.ID)
  17. assert.Check(t, is.Equal(info.ContainerdCommit.Expected, info.ContainerdCommit.ID))
  18. assert.Check(t, "N/A" != info.InitCommit.ID)
  19. assert.Check(t, is.Equal(info.InitCommit.Expected, info.InitCommit.ID))
  20. assert.Check(t, "N/A" != info.RuncCommit.ID)
  21. assert.Check(t, is.Equal(info.RuncCommit.Expected, info.RuncCommit.ID))
  22. }
  23. func TestInfoAPIVersioned(t *testing.T) {
  24. ctx := testutil.StartSpan(baseContext, t)
  25. // Windows only supports 1.25 or later
  26. res, body, err := req.Get(ctx, "/v1.24/info")
  27. assert.NilError(t, err)
  28. assert.Check(t, is.DeepEqual(res.StatusCode, http.StatusOK))
  29. b, err := req.ReadBody(body)
  30. assert.NilError(t, err)
  31. // Verify the old response on API 1.24 and older before commit
  32. // 6d98e344c7702a8a713cb9e02a19d83a79d3f930.
  33. out := string(b)
  34. assert.Check(t, is.Contains(out, "ExecutionDriver"))
  35. assert.Check(t, is.Contains(out, "not supported"))
  36. }