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
5 changes: 5 additions & 0 deletions josh-proxy/src/bin/josh-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,11 @@ async fn run_proxy() -> josh::JoshResult<i32> {
ARGS.value_of("local")
.ok_or(josh::josh_error("missing local directory"))?,
);
let local = if local.is_absolute() {
local
} else {
std::env::current_dir()?.join(local)
};

josh_proxy::create_repo(&local)?;
josh::cache::load(&local)?;
Expand Down
5 changes: 3 additions & 2 deletions tests/proxy/setup_test_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ echo $! > "${TESTTMP}/server_pid"
cp -R "${TESTDIR}/../../static/" static

if [ -z "${CARGO_TARGET_DIR}" ]; then
TARGET_DIR=${TESTDIR}/../../target
export TARGET_DIR=${TESTDIR}/../../target
else
TARGET_DIR=${CARGO_TARGET_DIR}
export TARGET_DIR=${CARGO_TARGET_DIR}
fi

# shellcheck disable=SC2086
Expand All @@ -50,6 +50,7 @@ do
if [ $COUNTER -ge 20 ];
then
>&2 echo "Starting josh proxy timed out"
cat ${TESTTMP}/josh-proxy.out >&2
exit 1
fi
done
48 changes: 48 additions & 0 deletions tests/proxy/shell.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
$ . ${TESTDIR}/setup_test_env.sh
$ kill -9 $(cat ${TESTTMP}/proxy_pid)
$ ${TARGET_DIR}/debug/josh-proxy --help
josh-proxy

USAGE:
josh-proxy [OPTIONS]

OPTIONS:
-c, --cache-duration <cache-duration>
Duration between forced cache refresh

--gc
Run git gc in maintanance

-h, --help
Print help information

--local <local>


-n <n>
Number of concurrent upstream git fetch/push operations

--no-background


--poll <poll>


--port <port>


--remote <remote>


--require-auth


--static-resource-proxy-target <static-resource-proxy-target>
Proxy static resource requests to a different URL

$ ${TARGET_DIR}/debug/josh-proxy --port=8002 --local=../../tmp --remote=http://localhost:8001 2>&1 > proxy.out &
$ sleep 1
$ kill -9 $!
$ grep "init mirror repo" proxy.out
* DEBUG josh_proxy: init mirror repo: "/tmp/cramtests-*/shell.t/../../tmp/mirror" (glob)
$ rm -Rf ../../tmp