mirror of
https://github.com/docker/compose.git
synced 2025-07-01 10:54:29 +02:00
Merge pull request #10953 from thaJeztah/drop_uuid
pkg/api: replace uuid for basic random id
This commit is contained in:
commit
d0dfb848df
@ -19,6 +19,7 @@ package api
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/rand"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -31,8 +32,6 @@ import (
|
|||||||
"github.com/docker/buildx/builder"
|
"github.com/docker/buildx/builder"
|
||||||
"github.com/docker/buildx/util/imagetools"
|
"github.com/docker/buildx/util/imagetools"
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
|
|
||||||
"github.com/distribution/distribution/v3/uuid"
|
|
||||||
moby "github.com/docker/docker/api/types"
|
moby "github.com/docker/docker/api/types"
|
||||||
containerType "github.com/docker/docker/api/types/container"
|
containerType "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/events"
|
"github.com/docker/docker/api/types/events"
|
||||||
@ -298,7 +297,9 @@ func (d *DryRunClient) VolumeRemove(ctx context.Context, volumeID string, force
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *DryRunClient) ContainerExecCreate(ctx context.Context, container string, config moby.ExecConfig) (moby.IDResponse, error) {
|
func (d *DryRunClient) ContainerExecCreate(ctx context.Context, container string, config moby.ExecConfig) (moby.IDResponse, error) {
|
||||||
id := uuid.Generate().String()
|
b := make([]byte, 32)
|
||||||
|
_, _ = rand.Read(b)
|
||||||
|
id := fmt.Sprintf("%x", b)
|
||||||
d.execs.Store(id, execDetails{
|
d.execs.Store(id, execDetails{
|
||||||
container: container,
|
container: container,
|
||||||
command: config.Cmd,
|
command: config.Cmd,
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package e2e
|
package e2e
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -26,7 +27,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/distribution/distribution/v3/uuid"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
"gotest.tools/v3/assert/cmp"
|
"gotest.tools/v3/assert/cmp"
|
||||||
@ -127,7 +127,9 @@ func doTest(t *testing.T, svcName string, tarSync bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
waitForFlush := func() {
|
waitForFlush := func() {
|
||||||
sentinelVal := uuid.Generate().String()
|
b := make([]byte, 32)
|
||||||
|
_, _ = rand.Read(b)
|
||||||
|
sentinelVal := fmt.Sprintf("%x", b)
|
||||||
writeDataFile("wait.txt", sentinelVal)
|
writeDataFile("wait.txt", sentinelVal)
|
||||||
poll.WaitOn(t, checkFileContents("/app/data/wait.txt", sentinelVal))
|
poll.WaitOn(t, checkFileContents("/app/data/wait.txt", sentinelVal))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user