Skip to content

Commit

Permalink
impl workflow
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan committed Nov 14, 2024
1 parent e59acd5 commit e80cb0d
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 68 deletions.
60 changes: 53 additions & 7 deletions .github/workflows/compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ concurrency:
cancel-in-progress: true

env:
RESTIC_REPOSITORY: rest:http://127.0.0.1:8000/test
RESTIC_REPOSITORY: rest:http://restic:restic@127.0.0.1:8000/ci_repo
RESTIC_PASSWORD: restic

jobs:
test:
name: Test
test-restic:
name: Test server with restic
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
Expand Down Expand Up @@ -54,21 +54,67 @@ jobs:
with:
toolchain: stable

- name: Create fixtures
- name: Run server in background
run: cargo run -- serve -c tests/fixtures/test_data/rustic_server.toml -v &

- name: Run restic
shell: bash
run: |
restic init
restic backup tests/fixtures/test_data/test_repo_source
restic backup tests/fixtures/test_data/test_repo_source
restic check
restic forget --keep-last 1 --prune
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2

- name: Run Cargo Test
run: cargo test -r --test repositories --features ${{ matrix.feature }} -- test_restic_latest_repo_with_rustic_passes --exact --show-output --ignored
# test-hurl:
# name: Test server with hurl
# runs-on: ${{ matrix.job.os }}
# strategy:
# matrix:
# rust: [stable]
# job:
# - os: macos-latest
# - os: ubuntu-latest
# - os: windows-latest
# steps:
# - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
# if: github.event_name != 'pull_request'
# with:
# fetch-depth: 0

# - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
# if: github.event_name == 'pull_request'
# with:
# ref: ${{ github.event.pull_request.head.sha }}
# fetch-depth: 0

# - name: Install Rust toolchain
# uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1
# with:
# toolchain: stable

# - name: Install hurl
# uses: taiki-e/install-action@c6dc131d2c4291552cafb840290190a53b2cd937 # v2
# with:
# tool: hurl

# - name: Run server in background
# run: cargo run -- serve -c tests/fixtures/test_data/rustic_server.toml -v &

# - name: Run hurl
# shell: bash
# run: |
# hurl -i tests/fixtures/hurl/endpoints.hurl

# - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2

result:
name: Result (Compat)
runs-on: ubuntu-latest
needs:
- test
- test-restic
steps:
- name: Mark the job as successful
run: exit 0
Expand Down
2 changes: 1 addition & 1 deletion maskfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ PowerShell:

```powershell
[Diagnostics.Process]::Start("cargo", "run -- serve -c tests/fixtures/test_data/rustic_server.toml -v").WaitForExit()
```

<!-- cargo run -- serve -c tests/fixtures/test_data/rustic_server.toml -v -->

## test-restic-server
Expand Down
1 change: 0 additions & 1 deletion src/commands/serve.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! `serve` subcommand

use abscissa_core::{
config::Override,
status_err,
Expand Down
72 changes: 42 additions & 30 deletions tests/fixtures/hurl/endpoints.hurl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
HEAD http://127.0.0.1:8000/ci_repo/config
HTTP 403

# Login
# Access a new repository
HEAD http://127.0.0.1:8000/ci_repo/
[BasicAuth]
hurl: hurl
HTTP 405

# Create a new repository
POST http://127.0.0.1:8000/ci_repo/?create=true
[BasicAuth]
hurl: hurl
HTTP 200


HEAD http://127.0.0.1:8000/ci_repo/config
[BasicAuth]
hurl: hurl
Expand All @@ -15,17 +27,17 @@ hurl: hurl
HTTP 200
Content-Type: application/vnd.x.restic.rest.v1

GET http://127.0.0.1:8000/ci_repo/keys/92c489eaca950f3a9d860da1bef0af845dd8c74a9a34c860bd8e6a54bd2326d2
GET http://127.0.0.1:8000/ci_repo/keys/eb7e523a1916c2cc1c750dc89cd6024f5dd319814c417a3f9081578f8c2c4a76
RANGE: bytes=0-230
[BasicAuth]
hurl: hurl
HTTP 206
content-length: 231

GET http://127.0.0.1:8000/ci_repo/keys/92c489eaca950f3a9d860da1bef0af845dd8c74a9a34c860bd8e6a54bd2326d2
[BasicAuth]
hurl: hurl
HTTP 200
# GET http://127.0.0.1:8000/ci_repo/keys/eb7e523a1916c2cc1c750dc89cd6024f5dd319814c417a3f9081578f8c2c4a76
# [BasicAuth]
# hurl: hurl
# HTTP 200

GET http://127.0.0.1:8000/ci_repo/config
[BasicAuth]
Expand All @@ -37,10 +49,10 @@ GET http://127.0.0.1:8000/ci_repo/locks/
hurl: hurl
HTTP 200

POST http://127.0.0.1:8000/ci_repo/locks/ac4ff62472b009cf71c81199f4fc635152639909cb1143911150db467ca86544
[BasicAuth]
hurl: hurl
HTTP 200
# POST http://127.0.0.1:8000/ci_repo/locks/ac4ff62472b009cf71c81199f4fc635152639909cb1143911150db467ca86544
# [BasicAuth]
# hurl: hurl
# HTTP 200

GET http://127.0.0.1:8000/ci_repo/locks/
[BasicAuth]
Expand All @@ -57,27 +69,27 @@ GET http://127.0.0.1:8000/ci_repo/index/
hurl: hurl
HTTP 200

POST http://127.0.0.1:8000/ci_repo/data/3b013253cd72fa7e98f9dcd6106f9565933556f1c80a720e1e44dbf3b57af446
[BasicAuth]
hurl: hurl
HTTP 200
# POST http://127.0.0.1:8000/ci_repo/data/3b013253cd72fa7e98f9dcd6106f9565933556f1c80a720e1e44dbf3b57af446
# [BasicAuth]
# hurl: hurl
# HTTP 200

POST http://127.0.0.1:8000/ci_repo/data/89923722810777f3026a7cf9b246eb9613c7e3f64e77e6ccecb4001774c38acf
[BasicAuth]
hurl: hurl
HTTP 200
# POST http://127.0.0.1:8000/ci_repo/data/89923722810777f3026a7cf9b246eb9613c7e3f64e77e6ccecb4001774c38acf
# [BasicAuth]
# hurl: hurl
# HTTP 200

POST http://127.0.0.1:8000/ci_repo/index/004ebe81e7927131b6dde40bd4595ebf95a355bf26509de83fb9d12b4ab280b4
[BasicAuth]
hurl: hurl
HTTP 200
# POST http://127.0.0.1:8000/ci_repo/index/004ebe81e7927131b6dde40bd4595ebf95a355bf26509de83fb9d12b4ab280b4
# [BasicAuth]
# hurl: hurl
# HTTP 200

POST http://127.0.0.1:8000/ci_repo/snapshots/ddd75013f2d2470d910adadf728c5c8cd6e91cb591bdfbf1cfd7f3af7e32c7eb
[BasicAuth]
hurl: hurl
HTTP 200
# POST http://127.0.0.1:8000/ci_repo/snapshots/ddd75013f2d2470d910adadf728c5c8cd6e91cb591bdfbf1cfd7f3af7e32c7eb
# [BasicAuth]
# hurl: hurl
# HTTP 200

DELETE http://127.0.0.1:8000/ci_repo/locks/ac4ff62472b009cf71c81199f4fc635152639909cb1143911150db467ca86544
[BasicAuth]
hurl: hurl
HTTP 200
# DELETE http://127.0.0.1:8000/ci_repo/locks/ac4ff62472b009cf71c81199f4fc635152639909cb1143911150db467ca86544
# [BasicAuth]
# hurl: hurl
# HTTP 200
29 changes: 0 additions & 29 deletions tests/integration.rs

This file was deleted.

0 comments on commit e80cb0d

Please sign in to comment.