Update test scripts to account for cwd
This commit is contained in:
parent
f39f525294
commit
f2ab5ac6d5
3
.envrc
3
.envrc
@ -1,5 +1,6 @@
|
|||||||
layout go
|
layout go
|
||||||
use flake
|
use flake
|
||||||
export INTAKE_DATA_DIR=tmp
|
rootPath=$(dirname $(dirname $(realpath "$0")))
|
||||||
|
export INTAKE_DATA_DIR=$(expand_path tmp)
|
||||||
|
|
||||||
unset AR AS CC CONFIG_SHELL CXX HOST_PATH LD NIX_BINTOOLS NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu NIX_BUILD_CORES NIX_CC NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu NIX_CFLAGS_COMPILE NIX_ENFORCE_NO_NATIVE NIX_HARDENING_ENABLE NIX_LDFLAGS NIX_STORE NM OBJCOPY OBJDUMP RANLIB READELF SIZE SOURCE_DATE_EPOCH STRINGS STRIP __structuredAttrs buildInputs buildPhase builder cmakeFlags configureFlags depsBuildBuild depsBuildBuildPropagated depsBuildTarget depsBuildTargetPropagated depsHostHost depsHostHostPropagated depsTargetTarget depsTargetTargetPropagated doCheck doInstallCheck dontAddDisableDepTrack mesonFlags name nativeBuildInputs out outputs patches phases preferLocalBuild propagatedBuildInputs propagatedNativeBuildInputs shell shellHook stdenv strictDeps system
|
unset AR AS CC CONFIG_SHELL CXX HOST_PATH LD NIX_BINTOOLS NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu NIX_BUILD_CORES NIX_CC NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu NIX_CFLAGS_COMPILE NIX_ENFORCE_NO_NATIVE NIX_HARDENING_ENABLE NIX_LDFLAGS NIX_STORE NM OBJCOPY OBJDUMP RANLIB READELF SIZE SOURCE_DATE_EPOCH STRINGS STRIP __structuredAttrs buildInputs buildPhase builder cmakeFlags configureFlags depsBuildBuild depsBuildBuildPropagated depsBuildTarget depsBuildTargetPropagated depsHostHost depsHostHostPropagated depsTargetTarget depsTargetTargetPropagated doCheck doInstallCheck dontAddDisableDepTrack mesonFlags name nativeBuildInputs out outputs patches phases preferLocalBuild propagatedBuildInputs propagatedNativeBuildInputs shell shellHook stdenv strictDeps system
|
||||||
|
8
Makefile
8
Makefile
@ -1,10 +1,16 @@
|
|||||||
.PHONY: help serve test-data demo
|
.PHONY: help serve test-data demo
|
||||||
|
|
||||||
|
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
help: ## display this help
|
help: ## display this help
|
||||||
@awk 'BEGIN{FS = ":.*##"; printf "\033[1m\nUsage\n \033[1;92m make\033[0;36m <target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST)
|
@awk 'BEGIN{FS = ":.*##"; printf "\033[1m\nUsage\n \033[1;92m make\033[0;36m <target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
serve: ## Run "intake serve" with live reload
|
serve: ## Run "intake serve" with live reload
|
||||||
@air -build.cmd "go build -o tmp/intake" -build.bin tmp/intake -build.args_bin serve,--data-dir,tmp -build.include_ext "go,html,css"
|
@air \
|
||||||
|
-build.cmd "go build -o ${ROOT_DIR}/tmp/intake" \
|
||||||
|
-build.bin ${ROOT_DIR}/tmp/intake \
|
||||||
|
-build.args_bin serve \
|
||||||
|
-build.include_ext "go,html,css"
|
||||||
|
|
||||||
test-data: ## Recreate test data in tmp/
|
test-data: ## Recreate test data in tmp/
|
||||||
@test/test_items.sh
|
@test/test_items.sh
|
||||||
|
5
test/hello.sh
Executable file
5
test/hello.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cat /dev/random \
|
||||||
|
| base32 \
|
||||||
|
| head -c8 \
|
||||||
|
| jq -cR '{id: ., title: "Hello"}'
|
@ -1,9 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
go build -o tmp/intake
|
rootPath=$(dirname $(dirname $(realpath "$0")))
|
||||||
rm tmp/intake.db* || true
|
|
||||||
export INTAKE_DATA_DIR="tmp"
|
rm -v "$rootPath"/tmp/intake.db* || true
|
||||||
|
cp -v "$rootPath"/test/*.sh "$rootPath/tmp/"
|
||||||
|
go build -o "$rootPath/tmp/intake"
|
||||||
|
export INTAKE_DATA_DIR="$rootPath/tmp"
|
||||||
tmp/intake migrate
|
tmp/intake migrate
|
||||||
|
|
||||||
# testing item display format
|
# testing item display format
|
||||||
@ -57,7 +60,7 @@ tmp/intake item add -s page --id 212 --title "Item 212" --body "This is the body
|
|||||||
# test auto update
|
# test auto update
|
||||||
tmp/intake source env -s nothing --set "INTAKE_FETCH=every 5m"
|
tmp/intake source env -s nothing --set "INTAKE_FETCH=every 5m"
|
||||||
tmp/intake source add -s hello
|
tmp/intake source add -s hello
|
||||||
tmp/intake action add -s hello -a fetch -- sh -c "cat /dev/random | base32 | head -c8 | jq -cR '{id: ., title: \"Hello\"}'"
|
tmp/intake action add -s hello -a fetch -- ./hello.sh
|
||||||
tmp/intake source env -s hello --set "INTAKE_FETCH=every 1m"
|
tmp/intake source env -s hello --set "INTAKE_FETCH=every 1m"
|
||||||
# and batch
|
# and batch
|
||||||
tmp/intake source env -s hello --set "INTAKE_BATCH=00:00"
|
tmp/intake source env -s hello --set "INTAKE_BATCH=00:00"
|
||||||
|
Loading…
Reference in New Issue
Block a user