mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore: update docker and compose Go dependencies to the latest versions
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/go-units"
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ const (
|
||||
)
|
||||
|
||||
type Container struct {
|
||||
types.ContainerJSON
|
||||
container.InspectResponse
|
||||
// created caches the parsed creation time by CreatedTime.
|
||||
created time.Time
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func (c *Container) Healthy() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
return c.State.Health.Status == types.Healthy
|
||||
return c.State.Health.Status == container.Healthy
|
||||
}
|
||||
|
||||
// HumanState returns a human-readable description of the container's state. Based on the Docker implementation:
|
||||
@@ -78,7 +78,7 @@ func (c *Container) HumanState() (string, error) {
|
||||
|
||||
if c.State.Health != nil {
|
||||
status := c.State.Health.Status
|
||||
if status == types.Starting {
|
||||
if status == container.Starting {
|
||||
status = "health: " + status
|
||||
}
|
||||
|
||||
|
||||
+30
-31
@@ -4,7 +4,6 @@ import (
|
||||
"net/netip"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -15,9 +14,9 @@ func TestContainer_Healthy(t *testing.T) {
|
||||
|
||||
t.Run("exited", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := &Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
c := &Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Running: false,
|
||||
Dead: false,
|
||||
ExitCode: 0,
|
||||
@@ -29,9 +28,9 @@ func TestContainer_Healthy(t *testing.T) {
|
||||
|
||||
t.Run("running with no health check", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := &Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
c := &Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Running: true,
|
||||
},
|
||||
},
|
||||
@@ -41,12 +40,12 @@ func TestContainer_Healthy(t *testing.T) {
|
||||
|
||||
t.Run("running and healthy", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := &Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
c := &Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Running: true,
|
||||
Health: &types.Health{
|
||||
Status: types.Healthy,
|
||||
Health: &container.Health{
|
||||
Status: container.Healthy,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -56,12 +55,12 @@ func TestContainer_Healthy(t *testing.T) {
|
||||
|
||||
t.Run("running but unhealthy", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := &Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
c := &Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Running: true,
|
||||
Health: &types.Health{
|
||||
Status: types.Unhealthy,
|
||||
Health: &container.Health{
|
||||
Status: container.Unhealthy,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -71,11 +70,11 @@ func TestContainer_Healthy(t *testing.T) {
|
||||
|
||||
t.Run("running with health starting", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := &Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
c := &Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Running: true,
|
||||
Health: &types.Health{
|
||||
Health: &container.Health{
|
||||
Status: "starting",
|
||||
},
|
||||
},
|
||||
@@ -86,9 +85,9 @@ func TestContainer_Healthy(t *testing.T) {
|
||||
|
||||
t.Run("dead", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := &Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
c := &Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Dead: true,
|
||||
Running: false,
|
||||
},
|
||||
@@ -99,9 +98,9 @@ func TestContainer_Healthy(t *testing.T) {
|
||||
|
||||
t.Run("restarting", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := &Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
c := &Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Restarting: true,
|
||||
Running: true,
|
||||
ExitCode: 1,
|
||||
@@ -113,9 +112,9 @@ func TestContainer_Healthy(t *testing.T) {
|
||||
|
||||
t.Run("paused", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := &Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
c := &Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Paused: true,
|
||||
Running: true,
|
||||
},
|
||||
@@ -280,7 +279,7 @@ func TestContainer_ConflictingServicePorts(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ctr := &ServiceContainer{Container: Container{ContainerJSON: types.ContainerJSON{
|
||||
ctr := &ServiceContainer{Container: Container{InspectResponse: container.InspectResponse{
|
||||
Config: &container.Config{
|
||||
Labels: map[string]string{
|
||||
LabelServicePorts: tt.containerPorts,
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@ package api
|
||||
|
||||
import (
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
||||
@@ -10,7 +9,7 @@ import (
|
||||
|
||||
type MachineImage struct {
|
||||
Metadata *pb.Metadata
|
||||
Image types.ImageInspect
|
||||
Image image.InspectResponse
|
||||
}
|
||||
|
||||
// MachineImages represents images present on a particular machine.
|
||||
|
||||
Reference in New Issue
Block a user