Skip to content

Commit da3634b

Browse files
OrlovEvgenypsviderskitonyo
authored
E2E tests use repeated strings for test data where constants add no value (#97)
--------- Co-authored-by: Pasha Sviderski <[email protected]> Co-authored-by: Anton Ovchinnikov <[email protected]>
1 parent 6fb07db commit da3634b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+170
-116
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ jobs:
2525
with:
2626
go-version: "1.23.2"
2727

28+
- name: golangci-lint
29+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
30+
with:
31+
version: v2.2.2
32+
2833
- name: Format code
2934
run: |
3035
make format
3136
git diff --exit-code ||
3237
(echo "Code is not formatted. Please run 'make format' and commit the changes." && exit 1)
3338
34-
- name: golangci-lint
35-
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
36-
with:
37-
version: v2.2.2
38-
3939
timeout-minutes: 10

.golangci.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
version: "2"
2+
3+
run:
4+
concurrency: 4
5+
tests: true
6+
timeout: 5m
7+
28
linters:
39
default: none
410
enable:
@@ -23,8 +29,14 @@ linters:
2329
# - unparam
2430
# - unused
2531
- whitespace
32+
exclusions:
33+
rules:
34+
- path: ^test/e2e
35+
linters:
36+
- goconst # constants here add no value, so we skip goconst only for test/e2e.
2637

2738
formatters:
2839
enable:
29-
- gofmt
30-
# - goimports
40+
- gofumpt
41+
- goimports
42+

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,19 @@ test-clean:
8989
vet:
9090
go vet ./...
9191

92-
.PHONY: format
93-
format:
94-
go fmt ./...
92+
.PHONY: format fmt
93+
format fmt:
94+
GOOS=linux golangci-lint fmt
9595

9696
LINT_TARGETS := lint lint-and-fix
9797
.PHONY: $(LINT_TARGETS) _lint
9898
$(LINT_TARGETS): _lint
9999
lint: ARGS=
100100
lint-and-fix: ARGS=--fix
101101
_lint:
102-
golangci-lint run $(ARGS)
102+
# Explicitly set OS to Linux to not skip *_linux.go files when running on macOS.
103+
# Uncloud daemon won't likely support OS other than Linux anytime soon, so for now we can rely on that.
104+
GOOS=linux golangci-lint run $(ARGS)
103105

104106
.PHONY: docs-image-push
105107
docs-image-push:

cmd/ucind/cluster/create.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cluster
22

33
import (
44
"fmt"
5+
56
"github.com/psviderski/uncloud/internal/ucind"
67
"github.com/spf13/cobra"
78
)

cmd/ucind/cluster/remove.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cluster
22

33
import (
44
"fmt"
5+
56
"github.com/psviderski/uncloud/internal/ucind"
67
"github.com/spf13/cobra"
78
)

cmd/ucind/cluster/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func NewRootCommand() *cobra.Command {
1313
}
1414
cmd.AddCommand(
1515
NewCreateCommand(),
16-
//NewListCommand(),
16+
// NewListCommand(),
1717
NewRemoveCommand(),
1818
)
1919
return cmd

cmd/uncloud/machine/rm.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ func remove(ctx context.Context, uncli *cli.CLI, machineName string, opts remove
101101
err = progress.RunWithTitle(ctx, func(ctx context.Context) error {
102102
return removeContainers(ctx, client, containers)
103103
}, uncli.ProgressOut(), "Removing containers")
104-
105104
if err != nil {
106105
return fmt.Errorf("remove containers: %w", err)
107106
}
@@ -112,8 +111,8 @@ func remove(ctx context.Context, uncli *cli.CLI, machineName string, opts remove
112111
// TODO: 5. Remove the machine from the cluster store.
113112

114113
return fmt.Errorf("resetting machine is not fully implemented yet")
115-
//fmt.Printf("Machine '%s' removed from the cluster.\n", m.Name)
116-
//return nil
114+
// fmt.Printf("Machine '%s' removed from the cluster.\n", m.Name)
115+
// return nil
117116
}
118117

119118
// formatContainerTree formats a list of containers grouped by service as a tree structure.

cmd/uncloud/machine/token.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package machine
22

33
import (
44
"fmt"
5+
56
"github.com/psviderski/uncloud/internal/daemon"
67
"github.com/psviderski/uncloud/internal/machine"
78
"github.com/spf13/cobra"

cmd/uncloud/service/inspect.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/docker/docker/pkg/stringid"
1111
"github.com/docker/go-units"
12-
1312
"github.com/psviderski/uncloud/internal/cli"
1413
"github.com/spf13/cobra"
1514
)

experiment/broadcaster.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package main
33
import (
44
"context"
55
"fmt"
6-
"github.com/hashicorp/serf/serf"
7-
crdt "github.com/ipfs/go-ds-crdt"
86
"log/slog"
97
"time"
8+
9+
"github.com/hashicorp/serf/serf"
10+
crdt "github.com/ipfs/go-ds-crdt"
1011
)
1112

1213
// Implements the Broadcaster interface.

0 commit comments

Comments
 (0)