Skip to content

Commit

Permalink
revert go mod upgarde (#1757)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanxin authored Sep 1, 2023
1 parent 34a131f commit 6ad024b
Show file tree
Hide file tree
Showing 7 changed files with 474 additions and 495 deletions.
2 changes: 1 addition & 1 deletion cmd/kyma/alpha/enable/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func filterModuleTemplates(allTemplates v1beta2.ModuleTemplateList,
filteredModuleTemplates = append(filteredModuleTemplates, mt)
continue
}
descriptor, err := mt.GetDescriptor()
descriptor, err := mt.Spec.GetDescriptor()
if err != nil {
return nil, fmt.Errorf("invalid ModuleTemplate descriptor: %v", err)
}
Expand Down
9 changes: 4 additions & 5 deletions cmd/kyma/alpha/enable/module/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package module

import (
"context"
"strings"
"testing"

"github.com/kyma-project/cli/cmd/kyma/alpha/enable/module/mock"
"github.com/kyma-project/lifecycle-manager/api/v1beta2"
"github.com/kyma-project/lifecycle-manager/pkg/testutils"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"strings"
"testing"
)

func TestChannelValidation(t *testing.T) {
Expand All @@ -20,13 +19,13 @@ func TestChannelValidation(t *testing.T) {
ControllerName: "-",
Channel: "fast",
CustomResourcePolicy: "-",
}, unstructured.Unstructured{}, false, false, false, false)
}, unstructured.Unstructured{}, false, false, false)
template2, _ := testutils.ModuleTemplateFactory(v1beta2.Module{
Name: "not-test",
ControllerName: "-",
Channel: "alpha",
CustomResourcePolicy: "-",
}, unstructured.Unstructured{}, false, false, false, false)
}, unstructured.Unstructured{}, false, false, false)
allTemplates := v1beta2.ModuleTemplateList{
TypeMeta: metav1.TypeMeta{},
ListMeta: metav1.ListMeta{},
Expand Down
244 changes: 123 additions & 121 deletions go.mod

Large diffs are not rendered by default.

640 changes: 316 additions & 324 deletions go.sum

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions pkg/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"os"
"strings"
"time"

dockerConfig "github.com/docker/cli/cli/config"
configTypes "github.com/docker/cli/cli/config/types"
Expand Down Expand Up @@ -37,10 +38,10 @@ type dockerWrapper struct {
//go:generate mockery --name Client
type Client interface {
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig,
platform *specs.Platform, containerName string) (container.CreateResponse, error)
platform *specs.Platform, containerName string) (container.ContainerCreateCreatedBody, error)
ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
ContainerStop(ctx context.Context, containerID string, options container.StopOptions) error
ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)
ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error)
Expand Down Expand Up @@ -162,7 +163,7 @@ func (w *dockerWrapper) ContainerFollowRun(ctx context.Context, containerID stri
func (w *dockerWrapper) Stop(ctx context.Context, containerID string, log func(...interface{})) func() {
return func() {
log(fmt.Sprintf("\r- Removing container %s...\n", containerID))
err := w.Docker.ContainerStop(ctx, containerID, container.StopOptions{})
err := w.Docker.ContainerStop(ctx, containerID, nil)
if err != nil {
log(err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/docker/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func Test_PullImageAndStartContainer(t *testing.T) {

mockDocker.On("ContainerCreate", ctx, mock.AnythingOfType("*container.Config"),
mock.AnythingOfType("*container.HostConfig"), mock.Anything, mock.Anything, testOpts.ContainerName).Return(
container.CreateResponse{ID: testContainerID}, nil).Times(1)
container.ContainerCreateCreatedBody{ID: testContainerID}, nil).Times(1)

mockDocker.On("ContainerStart", ctx, testContainerID, mock.AnythingOfType("types.ContainerStartOptions")).Return(nil).Times(1)

Expand All @@ -154,7 +154,7 @@ func Test_PullImageAndStartContainer(t *testing.T) {

mockDocker.On("ContainerCreate", ctx, mock.AnythingOfType("*container.Config"),
mock.AnythingOfType("*container.HostConfig"), mock.Anything, mock.Anything, testOpts.ContainerName).Return(
container.CreateResponse{}, testErr).Times(1)
container.ContainerCreateCreatedBody{}, testErr).Times(1)

id, err := mockWrapper.PullImageAndStartContainer(ctx, testOpts)

Expand All @@ -169,7 +169,7 @@ func Test_PullImageAndStartContainer(t *testing.T) {

mockDocker.On("ContainerCreate", ctx, mock.AnythingOfType("*container.Config"),
mock.AnythingOfType("*container.HostConfig"), mock.Anything, mock.Anything, testOpts.ContainerName).Return(
container.CreateResponse{ID: testContainerID}, nil).Times(1)
container.ContainerCreateCreatedBody{ID: testContainerID}, nil).Times(1)

mockDocker.On("ContainerStart", ctx, testContainerID, mock.AnythingOfType("types.ContainerStartOptions")).Return(testErr).Times(1)

Expand Down
61 changes: 23 additions & 38 deletions pkg/docker/mocks/Client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6ad024b

Please sign in to comment.