cd docker
docker-compose -f init.yml up -d
docker inspect docker_mysql_1
docker inspect docker_redis_1
cd ..
vi config/confgen.sh
make clean all pack
mkdir out
mv open-falcon-v2.0.0.tar.gz out/
cd out
tar zxvf open-falcon-v2.0.0.tar.gz
./open-falcon start agent graph transfer hbs fe query
# all modules
make all
# specified module
make agentUse docker build at project root, for example:
docker build -t <image_name>:<image_tag> -f docker/alpine/Dockerfile .Agent for example:
./open-falcon agent [build|pack|start|stop|restart|status|tail]
We use govendor to manage the golang packages. Please install govendor before compilation.
go get -u github.com/kardianos/govendor
Most depended packages are saved under ./vendor dir. If you want to add or update a package, just run govendor fetch xxxx@commitID or govendor fetch [email protected], then you will find the package have been placed in ./vendor correctly.
Make sure you're using Go 1.5+ and GO15VENDOREXPERIMENT=1 env var is exported. (export GODEBUG=cgocheck=0 using Go 1.6+.)
make clean all pack
There are environment variables could be used to set-up properties for testing:
$OWL_TEST_PROPS_FILE- File name of properties$OWL_TEST_PROPS- Property content as single string$OWL_TEST_PROPS_SEP- Seperator to split record of property content in$OWL_TEST_PROPS
For example, you could use make go-test by:
OWL_TEST_PROPS="mysql.owl_portal=root:cepave@tcp(192.168.20.50:3306)/falcon_portal_test?parseTime=True&loc=Local" make go-test GO_TEST_VERBOSE=yes GO_TEST_FOLDER="modules/mysqlapi/rdb/owl"Or use go test:
OWL_TEST_PROPS="mysql.owl_portal=root:cepave@tcp(192.168.20.50:3306)/falcon_portal_test?parseTime=True&loc=Local" go test ./modules/mysqlapi/rdb/owl -test.vSince some tests(e.x. database unit test) are stateful, these tests should be run in single thread:
GOMAXPROCS=<n>- By environment variable-parallel <n>- By test flags
See go help testflag for detail information.
Example:
OWL_TEST_PROPS="mysql.owl_portal=root:cepave@tcp(192.168.20.50:3306)/falcon_portal_test?parseTime=True&loc=Local mysql.graph=root:cepave@tcp(192.168.20.50:3306)/graph?parseTime=True&loc=Local"
# By $GOMAXPROCS
GOMAXPROCS=1 go test ./modules/mysqlapi/...
# By -parallel
go test -parallel 1 ./modules/mysqlapi/...Variables:
GO_TEST_FOLDER- The inclusions of folders(recursively probed) to be testedGO_TEST_EXCLUDE- The exclusions of folders(include children), which are descendants ofGO_TEST_FOLDERGO_TEST_PROPS_FILE- If the value is viable, the execution of "go test" would have additional arguments-owl.test.propfile=<GO_TEST_PROPS_FILE>GO_TEST_PROPS- If the value is viable, the execution of "go test" would have additional arguments-owl.test=<GO_TEST_PROPS>GO_TEST_PROPS_SEP- If the value is viable, the execution of "go test" would have additional arguments-owl.test.sep=<GO_TEST_PROPS_SEP>GO_TEST_FLAGS- If the value is viable, the execution of "go test" would have additional flags<flags...>GO_TEST_VERBOSE- If the value is "yes", the execution of "go test -test.v"(with additional flags of 3-party frameworks) would be appliedGO_TEST_COVERAGE_FILE- If the value is viable, the execution of "go test" would be added with-coverprofile <file>
# Default execution
make go-test GO_TEST_FOLDER="modules common" GO_TEST_EXCLUDE="modules/fe modules/f2e-api"
# With MySql property and verbose output
make go-test GO_TEST_FOLDER="modules common" GO_TEST_EXCLUDE="modules/fe modules/f2e-api" GO_TEST_VERBOSE=yes GO_TEST_PROPS="mysql.owl_portal=root:cepave@tcp(192.168.20.50:3306)/falcon_portal_test?parseTime=True&loc=Local"See Makefile for default values of the two variables.
In fact, the Makefile uses go-test-all.sh to perform go-test.
This script would try to detect the importing of "common/testing/" in *_test.go files.
If the configuration is matched, this script would append -owl.test.propfile, -owl.test, or -owl.test.sep flags.
Arguments:
-t <folders>- The inclusions of folders(recursively probed) to be tested-e <folders>- The exclusions of folders(include children), which are descendants ofGO_TEST_FOLDER-f <args>- If the value is viable, the execution of "go test" would have additional arguments-owl.test.propfile=<args>-p <args>- If the value is viable, the execution of "go test" would have additional arguments-owl.test=<args>-s <args>- If the value is viable, the execution of "go test" would have additional arguments-owl.test.sep=<args>-a <flags>- If the value is viable, the execution of "go test" would have additional flags<flags>-v- If this flag is shown, the execution ofgo test -test.v(with additional flags of 3-party frameworks) would be applied-c <file>- If this flag is shown, the-coverprofile <file> would be set
# Default execution
./go-test-all.sh -t "modules common" -e "modules/fe modules/f2e-api"
# With MySql property and verbose output
./go-test-all.sh -t "modules common" -e "modules/fe modules/f2e-api" -v -p "mysql.owl_portal=root:cepave@tcp(192.168.20.50:3306)/falcon_portal_test?parseTime=True&loc=Local"Example of property file("sample.properties"):
mysql.owl_portal=root:cepave@tcp(192.168.20.50:3307)/falcon_portal
client.http.host=127.0.0.1
client.http.port=6040Execute by go-test-all.sh:
OWL_TEST_PROPS_FILE="$PWD/sample.properties" ./go-test-all.sh -t "modules/mysqlapi/restful"