Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run auto-formatter tool #7381

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/asset-syncer/server/postgresql_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func Test_PGinsertFiles(t *testing.T) {
namespace = "my-namespace"
repoName = "my-repo"
chartID string = repoName + "/wordpress"
filesID string = chartID + "-2.1.3"
filesID = chartID + "-2.1.3"
)
files := models.ChartFiles{ID: filesID, Readme: "foo", DefaultValues: "bar", Repo: &models.AppRepository{Namespace: namespace, Name: repoName}}
mock.ExpectQuery(`INSERT INTO files \(chart_id, repo_name, repo_namespace, chart_files_ID, info\)*`).
Expand Down
2 changes: 1 addition & 1 deletion cmd/asset-syncer/server/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sync"
"time"

semver "github.com/Masterminds/semver/v3"
"github.com/Masterminds/semver/v3"
"github.com/containerd/containerd/remotes/docker"
"github.com/disintegration/imaging"
"github.com/itchyny/gojq"
Expand Down
28 changes: 14 additions & 14 deletions cmd/asset-syncer/server/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ func Test_parseFilters(t *testing.T) {

func Test_fetchRepoIndex(t *testing.T) {
fakeServer := newFakeServer(t, map[string]*http.Response{
"/index.yaml": &http.Response{StatusCode: 200},
"/subpath/index.yaml": &http.Response{StatusCode: 200},
"/index.yaml": {StatusCode: 200},
"/subpath/index.yaml": {StatusCode: 200},
})
defer fakeServer.Close()
addr := fakeServer.URL
Expand Down Expand Up @@ -397,19 +397,19 @@ func Test_fetchAndImportIcon(t *testing.T) {
svgHeader.Set("Content-Type", "image/svg")

server := newFakeServer(t, map[string]*http.Response{
"/valid_icon.png": &http.Response{
"/valid_icon.png": {
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader(iconBytes())),
},
"/valid_svg_icon.svg": &http.Response{
"/valid_svg_icon.svg": {
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte("<svg width='100' height='100'></svg>"))),
Header: svgHeader,
},
"/download_fail.png": &http.Response{
"/download_fail.png": {
StatusCode: 500,
},
"/invalid_icon.png": &http.Response{
"/invalid_icon.png": {
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte("not a valid png"))),
},
Expand Down Expand Up @@ -707,7 +707,7 @@ func Test_fetchAndImportFiles(t *testing.T) {
func Test_ociAPICli(t *testing.T) {
t.Run("TagList - failed request", func(t *testing.T) {
server := newFakeServer(t, map[string]*http.Response{
"/v2/apache/tags/list": &http.Response{
"/v2/apache/tags/list": {
StatusCode: 500,
},
})
Expand Down Expand Up @@ -736,7 +736,7 @@ func Test_ociAPICli(t *testing.T) {

t.Run("TagList - successful request", func(t *testing.T) {
server := newFakeServer(t, map[string]*http.Response{
"/v2/apache/tags/list": &http.Response{
"/v2/apache/tags/list": {
StatusCode: 200,
Body: io.NopCloser(strings.NewReader(`{"name":"apache","tags":["7.5.1","8.1.1"]}`)),
},
Expand All @@ -760,7 +760,7 @@ func Test_ociAPICli(t *testing.T) {

t.Run("IsHelmChart - failed request", func(t *testing.T) {
server := newFakeServer(t, map[string]*http.Response{
"/v2/apache-bad/manifests/7.5.1": &http.Response{
"/v2/apache-bad/manifests/7.5.1": {
StatusCode: 500,
},
})
Expand Down Expand Up @@ -854,7 +854,7 @@ func Test_ociAPICli(t *testing.T) {

t.Run("CatalogAvailable - successful request", func(t *testing.T) {
server := newFakeServer(t, map[string]*http.Response{
"/v2/test/project/charts-index/manifests/latest": &http.Response{
"/v2/test/project/charts-index/manifests/latest": {
StatusCode: 200,
Body: io.NopCloser(strings.NewReader(chartsIndexManifestJSON)),
},
Expand Down Expand Up @@ -882,7 +882,7 @@ func Test_ociAPICli(t *testing.T) {

t.Run("CatalogAvailable - returns false for incorrect media type", func(t *testing.T) {
server := newFakeServer(t, map[string]*http.Response{
"/v2/test/project/charts-index/manifests/latest": &http.Response{
"/v2/test/project/charts-index/manifests/latest": {
StatusCode: 200,
Body: io.NopCloser(strings.NewReader(`{"config": {"mediaType": "something-else"}}`)),
},
Expand All @@ -909,7 +909,7 @@ func Test_ociAPICli(t *testing.T) {

t.Run("CatalogAvailable - returns false for a 404", func(t *testing.T) {
server := newFakeServer(t, map[string]*http.Response{
"/v2/test/project/charts-index/manifests/latest": &http.Response{
"/v2/test/project/charts-index/manifests/latest": {
StatusCode: 200,
Body: io.NopCloser(strings.NewReader(`{"config": {"mediaType": "something-else"}}`)),
},
Expand Down Expand Up @@ -1029,11 +1029,11 @@ func Test_ociAPICli(t *testing.T) {

t.Run("Catalog - successful request", func(t *testing.T) {
server := newFakeServer(t, map[string]*http.Response{
"/v2/test/project/charts-index/manifests/latest": &http.Response{
"/v2/test/project/charts-index/manifests/latest": {
StatusCode: 200,
Body: io.NopCloser(strings.NewReader(chartsIndexManifestJSON)),
},
"/v2/test/project/charts-index/blobs/sha256:f9f7df0ae3f50aaf9ff390034cec4286d2aa43f061ce4bc7aa3c9ac862800aba": &http.Response{
"/v2/test/project/charts-index/blobs/sha256:f9f7df0ae3f50aaf9ff390034cec4286d2aa43f061ce4bc7aa3c9ac862800aba": {
StatusCode: 200,
Body: io.NopCloser(strings.NewReader(chartsIndexMultipleJSON)),
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/kubeapps-apis/core/plugins/v1alpha1/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (s *PluginsServer) registerGRPC(p *plugin.Plugin, pluginDetail *plugins.Plu

grpcFn, ok := grpcRegFn.(grpcRegisterFunctionType)
if !ok {
var stubFn grpcRegisterFunctionType = func(GRPCPluginRegistrationOptions) (interface{}, error) {
var stubFn = func(GRPCPluginRegistrationOptions) (interface{}, error) {
return nil, nil
}
return nil, fmt.Errorf("unable to use %q in plugin %v due to mismatched signature.\nwant: %T\ngot: %T", grpcRegisterFunction, pluginDetail, stubFn, grpcRegFn)
Expand Down Expand Up @@ -225,7 +225,7 @@ func getPluginDetail(p *plugin.Plugin, pluginPath string) (*plugins.Plugin, erro

fn, ok := pluginDetailFn.(pluginDetailFunctionType)
if !ok {
var stubFn pluginDetailFunctionType = func() *plugins.Plugin { return &plugins.Plugin{} }
var stubFn = func() *plugins.Plugin { return &plugins.Plugin{} }
return nil, fmt.Errorf("unable to use %q in plugin %q due to a mismatched signature. \nwant: %T\ngot: %T", pluginDetailFunction, pluginPath, stubFn, pluginDetailFn)
}

Expand All @@ -243,7 +243,7 @@ func registerHTTP(p *plugin.Plugin, pluginDetail *plugins.Plugin, gwArgs core.Ga
if !ok {
// Create a stubFn only so we can ensure the correct type is shown in case
// of an error.
var stubFn gatewayRegisterFunctionType = func(context.Context, *runtime.ServeMux, string, []grpc.DialOption) error { return nil }
var stubFn = func(context.Context, *runtime.ServeMux, string, []grpc.DialOption) error { return nil }
return fmt.Errorf("unable to use %q in plugin %v due to mismatched signature.\nwant: %T\ngot: %T", gatewayRegisterFunction, pluginDetail, stubFn, gwRegFn)
}
return gwfn(gwArgs.Ctx, gwArgs.Mux, gwArgs.Addr, gwArgs.DialOptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
fluxplugin "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/plugins/fluxv2/packages/v1alpha1"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/common"
"golang.org/x/sync/semaphore"
grpc "google.golang.org/grpc"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
apiv1 "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
fluxmeta "github.com/fluxcd/pkg/apis/meta"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
redismock "github.com/go-redis/redismock/v8"
"github.com/go-redis/redismock/v8"
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/cache"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/common"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
fluxmeta "github.com/fluxcd/pkg/apis/meta"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
redismock "github.com/go-redis/redismock/v8"
"github.com/go-redis/redismock/v8"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
fluxmeta "github.com/fluxcd/pkg/apis/meta"
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/go-redis/redis/v8"
redismock "github.com/go-redis/redismock/v8"
"github.com/go-redis/redismock/v8"
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/cache"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/common"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
type kappClientsGetter func(headers http.Header, cluster, namespace string) (ctlapp.Apps, ctlres.IdentifiedResources, *kappcmdapp.FailingAPIServicesPolicy, ctlres.ResourceFilter, error)

const (
fallbackGlobalPackagingNamespace = "kapp-controller-packaging-global"
fallbackDefaultUpgradePolicy pkgutils.UpgradePolicy = pkgutils.UpgradePolicyNone
fallbackDefaultAllowDowngrades = false
fallbackTimeoutSeconds = 300
fallbackGlobalPackagingNamespace = "kapp-controller-packaging-global"
fallbackDefaultUpgradePolicy = pkgutils.UpgradePolicyNone
fallbackDefaultAllowDowngrades = false
fallbackTimeoutSeconds = 300
)

func fallbackDefaultPrereleasesVersionSelection() []string {
Expand Down
Loading
Loading