mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #51320 from thaJeztah/refactor_client_system_step1
client: refactor Events, Info, RegistryLogin
This commit is contained in:
@@ -756,9 +756,9 @@ func checkClusterHealth(t *testing.T, cl []*daemon.Daemon, managerCount, workerC
|
||||
|
||||
// check info in a poll.WaitOn(), because if the cluster doesn't have a leader, `info` will return an error
|
||||
checkInfo := func(t *testing.T) (any, string) {
|
||||
client := d.NewClientT(t)
|
||||
daemonInfo, err := client.Info(ctx)
|
||||
info = daemonInfo.Swarm
|
||||
apiClient := d.NewClientT(t)
|
||||
result, err := apiClient.Info(ctx, client.InfoOptions{})
|
||||
info = result.Info.Swarm
|
||||
return err, "cluster not ready in time"
|
||||
}
|
||||
poll.WaitOn(t, pollCheck(t, checkInfo, checker.IsNil()), poll.WithTimeout(defaultReconciliationTimeout))
|
||||
|
||||
@@ -21,8 +21,9 @@ func (s *DockerCLIInfoSuite) TestInfoSecurityOptions(c *testing.T) {
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer apiClient.Close()
|
||||
info, err := apiClient.Info(testutil.GetContext(c))
|
||||
result, err := apiClient.Info(testutil.GetContext(c), client.InfoOptions{})
|
||||
assert.NilError(c, err)
|
||||
info := result.Info
|
||||
|
||||
if Apparmor() {
|
||||
assert.Check(c, is.Contains(info.SecurityOptions, "name=apparmor"))
|
||||
|
||||
@@ -54,8 +54,9 @@ func (s *DockerCLIPluginLogDriverSuite) TestPluginLogDriverInfoList(c *testing.T
|
||||
assert.NilError(c, err)
|
||||
defer apiClient.Close()
|
||||
|
||||
info, err := apiClient.Info(testutil.GetContext(c))
|
||||
result, err := apiClient.Info(testutil.GetContext(c), client.InfoOptions{})
|
||||
assert.NilError(c, err)
|
||||
info := result.Info
|
||||
|
||||
drivers := strings.Join(info.Plugins.Log, " ")
|
||||
assert.Assert(c, is.Contains(drivers, "json-file"))
|
||||
|
||||
@@ -200,8 +200,9 @@ func daemonTime(t *testing.T) time.Time {
|
||||
assert.NilError(t, err)
|
||||
defer apiClient.Close()
|
||||
|
||||
info, err := apiClient.Info(testutil.GetContext(t))
|
||||
result, err := apiClient.Info(testutil.GetContext(t), client.InfoOptions{})
|
||||
assert.NilError(t, err)
|
||||
info := result.Info
|
||||
|
||||
dt, err := time.Parse(time.RFC3339Nano, info.SystemTime)
|
||||
assert.Assert(t, err == nil, "invalid time format in GET /info response")
|
||||
@@ -286,11 +287,11 @@ func minimalBaseImage() string {
|
||||
}
|
||||
|
||||
func getGoroutineNumber(ctx context.Context, apiClient client.APIClient) (int, error) {
|
||||
info, err := apiClient.Info(ctx)
|
||||
result, err := apiClient.Info(ctx, client.InfoOptions{})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return info.NGoroutines, nil
|
||||
return result.Info.NGoroutines, nil
|
||||
}
|
||||
|
||||
func waitForStableGoroutineCount(ctx context.Context, t poll.TestingT, apiClient client.APIClient) int {
|
||||
|
||||
Reference in New Issue
Block a user