add cache-proxy test (#557)
test to verify that a cache stored in one repo can't be restored in another Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/557 Reviewed-by: Gusted <gusted@noreply.code.forgejo.org> Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Co-authored-by: Kwonunn <kwonunnx@gmail.com> Co-committed-by: Kwonunn <kwonunnx@gmail.com>
This commit is contained in:
parent
4c1a4cbdac
commit
f3a9672647
7 changed files with 99 additions and 0 deletions
|
|
@ -147,6 +147,10 @@ function test_actions() {
|
||||||
run actions_verify_example $example
|
run actions_verify_example $example
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if dpkg --compare-versions $runner_version ge 6.3.0; then
|
||||||
|
run actions_verify_example cache-proxy
|
||||||
|
fi
|
||||||
|
|
||||||
if dpkg --compare-versions $version lt 7.1; then
|
if dpkg --compare-versions $version lt 7.1; then
|
||||||
for example in cron; do
|
for example in cron; do
|
||||||
run actions_verify_example $example
|
run actions_verify_example $example
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: code.forgejo.org/oci/node:20-bookworm
|
||||||
|
steps:
|
||||||
|
- name: cache restore
|
||||||
|
id: cachestep
|
||||||
|
uses: https://code.forgejo.org/actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/usr/local/bin/something
|
||||||
|
key: thecoolsecretcachekey
|
||||||
|
|
||||||
|
- name: verify something
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
test SOMETHING = $(cat /usr/local/bin/something)
|
||||||
|
|
||||||
|
- name: cache hit
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
test "${{ steps.cachestep.outputs.cache-hit }}" = true
|
||||||
22
actions/example-cache-proxy/run.sh
Normal file
22
actions/example-cache-proxy/run.sh
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
source $EXAMPLE_DIR/../../lib/lib.sh
|
||||||
|
|
||||||
|
api=$url/api/v1
|
||||||
|
repostorer=root/example-cache-proxy-storer
|
||||||
|
repogetter=root/example-cache-proxy-getter
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
forgejo-curl.sh api_json -X DELETE $api/repos/$repostorer >&/dev/null || true
|
||||||
|
forgejo-curl.sh api_json -X DELETE $api/repos/$repogetter >&/dev/null || true
|
||||||
|
|
||||||
|
forgejo-test-helper.sh push_workflow actions/example-$example/storer $url root example-$example-storer setup-forgejo $token
|
||||||
|
local shastorer=$(forgejo-test-helper.sh branch_tip $url $repostorer main)
|
||||||
|
|
||||||
|
forgejo-test-helper.sh wait_success $url $repostorer $shastorer
|
||||||
|
|
||||||
|
forgejo-test-helper.sh push_workflow actions/example-$example/getter $url root example-$example-getter setup-forgejo $token
|
||||||
|
local shagetter=$(forgejo-test-helper.sh branch_tip $url $repogetter main)
|
||||||
|
|
||||||
|
forgejo-test-helper.sh wait_failure $url $repogetter $shagetter
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
29
actions/example-cache-proxy/runner-config.yaml
Normal file
29
actions/example-cache-proxy/runner-config.yaml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
log:
|
||||||
|
level: debug
|
||||||
|
|
||||||
|
runner:
|
||||||
|
file: .runner
|
||||||
|
capacity: 1
|
||||||
|
env_file: .env
|
||||||
|
timeout: 3h
|
||||||
|
insecure: false
|
||||||
|
fetch_timeout: 5s
|
||||||
|
fetch_interval: 2s
|
||||||
|
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
|
||||||
|
|
||||||
|
cache:
|
||||||
|
enabled: true
|
||||||
|
dir: "/srv/example/cache"
|
||||||
|
host: ""
|
||||||
|
port: 0
|
||||||
|
|
||||||
|
container:
|
||||||
|
network: "bridge"
|
||||||
|
privileged: false
|
||||||
|
options:
|
||||||
|
workdir_parent:
|
||||||
|
valid_volumes: ["/srv/example"]
|
||||||
|
docker_host: ""
|
||||||
|
|
||||||
|
host:
|
||||||
|
workdir_parent:
|
||||||
1
actions/example-cache-proxy/setup.sh
Executable file
1
actions/example-cache-proxy/setup.sh
Executable file
|
|
@ -0,0 +1 @@
|
||||||
|
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: code.forgejo.org/oci/node:20-bookworm
|
||||||
|
steps:
|
||||||
|
- name: create something
|
||||||
|
run: echo SOMETHING > /usr/local/bin/something
|
||||||
|
|
||||||
|
- name: cache save
|
||||||
|
uses: https://code.forgejo.org/actions/cache/save@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/usr/local/bin/something
|
||||||
|
key: thecoolsecretcachekey
|
||||||
1
actions/example-cache-proxy/teardown.sh
Executable file
1
actions/example-cache-proxy/teardown.sh
Executable file
|
|
@ -0,0 +1 @@
|
||||||
|
forgejo-runner.sh reload
|
||||||
Loading…
Add table
Add a link
Reference in a new issue