From 36b20930877352356edd1e1d682713cbf6bbfb36 Mon Sep 17 00:00:00 2001 From: Aleksey Kravchenko Date: Fri, 10 Jan 2025 12:19:24 +0300 Subject: [PATCH 1/3] [#2] Remove unused variables Signed-off-by: Aleksey Kravchenko --- internal/backend/frostfs/frostfs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/backend/frostfs/frostfs.go b/internal/backend/frostfs/frostfs.go index fbe7ad909..688c17bd4 100644 --- a/internal/backend/frostfs/frostfs.go +++ b/internal/backend/frostfs/frostfs.go @@ -45,11 +45,11 @@ func NewFactory() location.Factory { return location.NewHTTPBackendFactory("frostfs", ParseConfig, location.NoPassword, Create, Open) } -func Open(ctx context.Context, cfg Config, rt http.RoundTripper) (backend.Backend, error) { +func Open(ctx context.Context, cfg Config, _ http.RoundTripper) (backend.Backend, error) { return open(ctx, cfg) } -func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (backend.Backend, error) { +func Create(ctx context.Context, cfg Config, _ http.RoundTripper) (backend.Backend, error) { return open(ctx, cfg) } @@ -81,7 +81,7 @@ func open(ctx context.Context, cfg Config) (backend.Backend, error) { }, nil } -func (b *Backend) IsPermanentError(err error) bool { +func (b *Backend) IsPermanentError(error) bool { return true } -- 2.45.3 From 14e1e5d39dfaad33412a680bac11758c2ea3603f Mon Sep 17 00:00:00 2001 From: Aleksey Kravchenko Date: Fri, 10 Jan 2025 12:20:36 +0300 Subject: [PATCH 2/3] [#2] Change timeouts for integration tests Signed-off-by: Aleksey Kravchenko --- internal/backend/frostfs/frostfs_test.go | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/internal/backend/frostfs/frostfs_test.go b/internal/backend/frostfs/frostfs_test.go index 4b6fea27f..a4d7dc8f9 100644 --- a/internal/backend/frostfs/frostfs_test.go +++ b/internal/backend/frostfs/frostfs_test.go @@ -15,6 +15,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" + dcontainer "github.com/docker/docker/api/types/container" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/wallet" "github.com/restic/restic/internal/backend" @@ -26,7 +27,10 @@ import ( func TestIntegration(t *testing.T) { filename := createWallet(t) - defer os.Remove(filename) + defer func() { + err := os.Remove(filename) + require.NoError(t, err) + }() rootCtx := context.Background() aioImage := "truecloudlab/frostfs-aio:" @@ -60,11 +64,11 @@ func TestIntegration(t *testing.T) { _, err = createContainer(ctx, p, owner, cfg.Container, "REP 1") require.NoError(t, err) - backend, err := Open(ctx, cfg, nil) + fsBackend, err := Open(ctx, cfg, nil) require.NoError(t, err) - t.Run("simple store load delete "+version, func(t *testing.T) { simpleStoreLoadDelete(ctx, t, backend) }) - t.Run("list "+version, func(t *testing.T) { simpleList(ctx, t, backend) }) + t.Run("simple store load delete "+version, func(t *testing.T) { simpleStoreLoadDelete(ctx, t, fsBackend) }) + t.Run("list "+version, func(t *testing.T) { simpleList(ctx, t, fsBackend) }) err = aioContainer.Terminate(ctx) require.NoError(t, err) @@ -135,7 +139,7 @@ func createContainer(ctx context.Context, client *pool.Pool, owner user.ID, cont wp := &pool.WaitParams{ PollInterval: 5 * time.Second, - Timeout: 30 * time.Second, + Timeout: 2 * time.Minute, } prm := pool.PrmContainerPut{ ClientParams: sdkClient.PrmContainerPut{ @@ -178,11 +182,13 @@ func createWallet(t *testing.T) string { func createDockerContainer(ctx context.Context, t *testing.T, image string) testcontainers.Container { req := testcontainers.ContainerRequest{ - Image: image, - WaitingFor: wait.NewLogStrategy("aio container started").WithStartupTimeout(30 * time.Second), - Name: "aio", - Hostname: "aio", - NetworkMode: "host", + Image: image, + WaitingFor: wait.NewLogStrategy("aio container started").WithStartupTimeout(time.Minute), + Name: "aio", + Hostname: "aio", + HostConfigModifier: func(hc *dcontainer.HostConfig) { + hc.NetworkMode = "host" + }, } aioC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ ContainerRequest: req, -- 2.45.3 From d49f366cfb1afab60ed012823785176ba16a32a7 Mon Sep 17 00:00:00 2001 From: Aleksey Kravchenko Date: Fri, 10 Jan 2025 12:21:21 +0300 Subject: [PATCH 3/3] [#2] Add forgejo CI jobs Signed-off-by: Aleksey Kravchenko --- .forgejo/ISSUE_TEMPLATE/bug_report.md | 45 +++++++++++++++++++ .forgejo/ISSUE_TEMPLATE/config.yml | 1 + .forgejo/ISSUE_TEMPLATE/feature_request.md | 20 +++++++++ .forgejo/workflows/builds.yaml | 24 +++++++++++ .forgejo/workflows/dco.yml | 20 +++++++++ .forgejo/workflows/tests.yml | 50 ++++++++++++++++++++++ 6 files changed, 160 insertions(+) create mode 100644 .forgejo/ISSUE_TEMPLATE/bug_report.md create mode 100644 .forgejo/ISSUE_TEMPLATE/config.yml create mode 100644 .forgejo/ISSUE_TEMPLATE/feature_request.md create mode 100644 .forgejo/workflows/builds.yaml create mode 100644 .forgejo/workflows/dco.yml create mode 100644 .forgejo/workflows/tests.yml diff --git a/.forgejo/ISSUE_TEMPLATE/bug_report.md b/.forgejo/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..7e778d2fe --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,45 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: community, triage, bug +assignees: '' + +--- + + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + + + + +## Steps to Reproduce (for bugs) + + + +1. + +## Context + + + +## Regression + + + +## Your Environment + +* Version used: +* Server setup and configuration: +* Operating System and version (`uname -a`): diff --git a/.forgejo/ISSUE_TEMPLATE/config.yml b/.forgejo/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..3ba13e0ce --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.forgejo/ISSUE_TEMPLATE/feature_request.md b/.forgejo/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..d6d1162a1 --- /dev/null +++ b/.forgejo/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: community, triage +assignees: '' + +--- + +## Is your feature request related to a problem? Please describe. + + +## Describe the solution you'd like + + +## Describe alternatives you've considered + + +## Additional context + diff --git a/.forgejo/workflows/builds.yaml b/.forgejo/workflows/builds.yaml new file mode 100644 index 000000000..d588a7fa6 --- /dev/null +++ b/.forgejo/workflows/builds.yaml @@ -0,0 +1,24 @@ +on: + pull_request: + push: + branches: + - tcl/master + +jobs: + builds: + name: Builds + runs-on: ubuntu-latest + strategy: + matrix: + go_versions: [ '1.22', '1.23' ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '${{ matrix.go_versions }}' + + - name: Build binary + run: make \ No newline at end of file diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml new file mode 100644 index 000000000..4acd63341 --- /dev/null +++ b/.forgejo/workflows/dco.yml @@ -0,0 +1,20 @@ +on: [pull_request] + +jobs: + dco: + name: DCO + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '1.23' + + - name: Run commit format checker + uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3 + with: + from: 'origin/${{ github.event.pull_request.base.ref }}' diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml new file mode 100644 index 000000000..ffdc44e0a --- /dev/null +++ b/.forgejo/workflows/tests.yml @@ -0,0 +1,50 @@ +on: + pull_request: + push: + branches: + - tcl/master + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.23' + cache: true + + - name: Install linters + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + + - name: Run linters + # we run the linter only through the FrostFS backend code + run: golangci-lint --timeout=5m run internal/backend/frostfs/ + + tests: + name: Tests + runs-on: oci-runner + strategy: + matrix: + go_versions: [ '1.23' ] + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '${{ matrix.go_versions }}' + + - name: Tests for the FrostFS backend + env: + RESTIC_TEST_FUSE: false + + # run only tests for the FrostFS backend + run: |- + podman-service.sh + podman info + go test -v github.com/restic/restic/internal/backend/frostfs \ No newline at end of file -- 2.45.3