Skip to content
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 .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mkdir -p /home/vscode/.local/share/pg/pgdata /home/vscode/.local/share/pg /home/
# Initialize Postgres
if [ ! -f "/home/vscode/.local/share/pg/pgdata/PG_VERSION" ]; then
echo "Initializing Postgres..."
/usr/lib/postgresql/16/bin/initdb -D /home/vscode/.local/share/pg/pgdata --auth trust --auth-local trust --auth-host trust
/usr/lib/postgresql/16/bin/initdb -D /home/vscode/.local/share/pg/pgdata --auth trust --auth-local trust --auth-host trust --encoding=UTF8 --locale=C.UTF-8
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this got clobbered again by some hook magic I didn't fully remove, sneaking in here b/c it was breaking my tests for validating the upgrades

echo "listen_addresses='localhost'" >> /home/vscode/.local/share/pg/pgdata/postgresql.conf
{
echo 'host all all 127.0.0.1/32 trust'
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/devcontainer-podman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

permissions:
contents: read
checks: write

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
Expand Down Expand Up @@ -76,16 +77,29 @@ jobs:
uses: parkan/github-actions/devcontainer-exec@v2
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && go test -v ./...'
command: >
cd /workspaces/singularity && mkdir -p artifacts && make test GOTESTSUM_ARGS="--junitfile artifacts/unit-tests.xml"
container-runtime: podman

- name: Run integration tests
uses: parkan/github-actions/devcontainer-exec@v2
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && SINGULARITY_TEST_INTEGRATION=true go test -v -timeout 20m -run "Integration" ./cmd/...'
command: >
cd /workspaces/singularity &&
mkdir -p artifacts &&
SINGULARITY_TEST_INTEGRATION=true make test GOTESTSUM_ARGS="--junitfile artifacts/integration-tests.xml -- -timeout 20m -run Integration ./cmd/..."
container-runtime: podman

- name: Report test results
if: always()
uses: dorny/test-reporter@v1
with:
name: Go tests
path: artifacts/*.xml
reporter: java-junit
fail-on-error: true

- name: Cleanup
if: always()
uses: parkan/github-actions/devcontainer-cleanup@v2
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
/baga*
singularity.db*

# Devcontainer
.devcontainer/

node_modules
/.pnp
.pnp.js
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24.0-bullseye AS builder
FROM golang:1.24.9-bookworm AS builder
WORKDIR /app
COPY go.* ./
RUN go mod download
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ help:
@echo " buildall Compile all Go code in all subdirectories."
@echo " generate Run the Go generate tool on all packages."
@echo " lint Run various linting and formatting tools."
@echo " test Execute tests using gotestsum."
@echo " test Execute tests using gotestsum. Use GOTESTSUM_FORMAT and GOTESTSUM_ARGS to customize."
@echo " diagram Generate a database schema diagram."
@echo " languagetool Check or install LanguageTool and process spelling."
@echo " godoclint Check Go source files for specific comment patterns."
Expand All @@ -17,7 +17,7 @@ install-lint-deps:
@which staticcheck > /dev/null || (echo "Required staticcheck not found. Installing it..." && go install honnef.co/go/tools/cmd/staticcheck@latest)

install-test-deps:
@which gotestsum > /dev/null || (echo "Installing gotestsum..." && GO111MODULE=on go get gotest.tools/gotestsum@latest)
@which gotestsum > /dev/null || (echo "Installing gotestsum..." && GOBIN=$$(go env GOPATH)/bin go install gotest.tools/gotestsum@latest)

build: check-go
go build -o singularity .
Expand All @@ -36,8 +36,10 @@ lint: check-go install-lint-deps
golangci-lint run --fix --timeout 10m
staticcheck ./...

GOTESTSUM_FORMAT ?= testname

test: check-go install-test-deps
go run gotest.tools/gotestsum@latest --format testname ./...
@PATH="$$(go env GOPATH)/bin:$$PATH" gotestsum --format $(GOTESTSUM_FORMAT) $(GOTESTSUM_ARGS) ./...

diagram: build
./singularity admin init
Expand Down
2 changes: 1 addition & 1 deletion cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/data-preservation-programs/singularity/handler"
"github.com/data-preservation-programs/singularity/model"
"github.com/data-preservation-programs/singularity/storagesystem"
"github.com/ipfs/go-log"
log "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2"
)

Expand Down
11 changes: 4 additions & 7 deletions cmd/storage/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ import (
"github.com/data-preservation-programs/singularity/storagesystem"
"github.com/data-preservation-programs/singularity/util"
"github.com/gotidy/ptr"
"github.com/rclone/rclone/fs"
"github.com/rjNemo/underscore"
"github.com/urfave/cli/v2"
)

var defaultClientConfig = fs.NewConfig()

var CommonConfigFlags = []cli.Flag{
&cli.IntFlag{
Name: "client-retry-max",
Expand Down Expand Up @@ -70,19 +67,19 @@ var httpClientConfigFlags = []cli.Flag{
&cli.DurationFlag{
Name: "client-connect-timeout",
Usage: "HTTP Client Connect timeout",
DefaultText: defaultClientConfig.ConnectTimeout.String(),
DefaultText: "1m0s", // rclone default
Category: "Client Config",
},
&cli.DurationFlag{
Name: "client-timeout",
Usage: "IO idle timeout",
DefaultText: defaultClientConfig.Timeout.String(),
DefaultText: "5m0s", // rclone default
Category: "Client Config",
},
&cli.DurationFlag{
Name: "client-expect-continue-timeout",
Usage: "Timeout when using expect / 100-continue in HTTP",
DefaultText: defaultClientConfig.ExpectContinueTimeout.String(),
DefaultText: "1s", // rclone default
Category: "Client Config",
},
&cli.BoolFlag{
Expand All @@ -100,7 +97,7 @@ var httpClientConfigFlags = []cli.Flag{
&cli.StringFlag{
Name: "client-user-agent",
Usage: "Set the user-agent to a specified string",
DefaultText: defaultClientConfig.UserAgent,
DefaultText: "rclone default", // Actual: "rclone/" + version
Category: "Client Config",
},
&cli.PathFlag{
Expand Down
8 changes: 4 additions & 4 deletions cmd/storage/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ var HTTPClientConfigFlagsForUpdate = []cli.Flag{
&cli.DurationFlag{
Name: "client-connect-timeout",
Usage: "HTTP Client Connect timeout",
DefaultText: defaultClientConfig.ConnectTimeout.String(),
DefaultText: "1m0s", // rclone default
Category: "Client Config",
},
&cli.DurationFlag{
Name: "client-timeout",
Usage: "IO idle timeout",
DefaultText: defaultClientConfig.Timeout.String(),
DefaultText: "5m0s", // rclone default
Category: "Client Config",
},
&cli.DurationFlag{
Name: "client-expect-continue-timeout",
Usage: "Timeout when using expect / 100-continue in HTTP",
DefaultText: defaultClientConfig.ExpectContinueTimeout.String(),
DefaultText: "1s", // rclone default
Category: "Client Config",
},
&cli.BoolFlag{
Expand All @@ -52,7 +52,7 @@ var HTTPClientConfigFlagsForUpdate = []cli.Flag{
&cli.StringFlag{
Name: "client-user-agent",
Usage: "Set the user-agent to a specified string. To remove, use empty string.",
DefaultText: defaultClientConfig.UserAgent,
DefaultText: "rclone default", // Actual: "rclone/" + version
Category: "Client Config",
},
&cli.PathFlag{
Expand Down
Loading