Some checks failed
Build and Release / Create Release (push) Successful in 0s
Trigger Vault Plugin Rebuild / Trigger Vault Rebuild (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 2m48s
Build and Release / Lint (push) Failing after 5m2s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (arm64, linux, linux-latest) (push) Has been skipped
Build and Release / Unit Tests (push) Successful in 5m37s
Go's semantic import versioning requires v2+ modules to include the major version in the module path. This enables using proper version tags (v3.x.x) instead of pseudo-versions. Updated module path: code.gitcaddy.com/server/v3
41 lines
882 B
Go
41 lines
882 B
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package attribute
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
|
|
"code.gitcaddy.com/server/v3/modules/git"
|
|
"code.gitcaddy.com/server/v3/modules/setting"
|
|
"code.gitcaddy.com/server/v3/modules/util"
|
|
)
|
|
|
|
func testRun(m *testing.M) error {
|
|
gitHomePath, err := os.MkdirTemp(os.TempDir(), "git-home")
|
|
if err != nil {
|
|
return fmt.Errorf("unable to create temp dir: %w", err)
|
|
}
|
|
defer util.RemoveAll(gitHomePath)
|
|
setting.Git.HomePath = gitHomePath
|
|
|
|
if err = git.InitFull(); err != nil {
|
|
return fmt.Errorf("failed to call Init: %w", err)
|
|
}
|
|
|
|
exitCode := m.Run()
|
|
if exitCode != 0 {
|
|
return fmt.Errorf("run test failed, ExitCode=%d", exitCode)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func TestMain(m *testing.M) {
|
|
if err := testRun(m); err != nil {
|
|
_, _ = fmt.Fprintf(os.Stderr, "Test failed: %v", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|