Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting common tests config file not working #65

Closed
dnldd opened this issue May 31, 2014 · 11 comments
Closed

Setting common tests config file not working #65

dnldd opened this issue May 31, 2014 · 11 comments

Comments

@dnldd
Copy link

dnldd commented May 31, 2014

Hi, I'm trying to run a test suite with my existing app config. Going through the erlang.mk options , CT_OPTS seemed like the way to go with this so I did try CT_OPTS = -config debug.config in my makefile. I still can't get access to my config file after doing this. How do you set external config files for common tests with erlang.mk? Thanks.

@essen
Copy link
Member

essen commented May 31, 2014

Like you did. Please post the makefile.

@dnldd
Copy link
Author

dnldd commented May 31, 2014

PROJECT = roadsigns

ERLC_OPTS ?= -Werror +debug_info
+warn_export_all +warn_export_vars
+warn_shadow_vars +warn_obsolete_guard

CT_SUITES = test

CT_OPTS = -config debug.config

DEPS = cowboy emysql jiffy lager erlcloud
dep_cowboy = https://github.com/extend/cowboy.git master
dep_emysql = https://github.com/Eonblast/Emysql.git v0.4.1
dep_jiffy = https://github.com/davisp/jiffy.git 0.8.5
dep_lager = https://github.com/basho/lager.git 2.0.3
dep_erlcloud = https://github.com/gleber/erlcloud.git master

cr:
rm -rf _rel/

cct:
rm -r ./logs

rd: app
if [ -n "${PROJECT}" ]; then erl -pa ebin -pa deps/*/ebin -smp -boot start_sasl ${ERL_ARGS} -config debug.config -name ${PROJECT}@hostname -s ${PROJECT};
else ${RUN} -s ${PROJECT};
fi

include erlang.mk

@essen
Copy link
Member

essen commented May 31, 2014

Yeah it should work. Is your config file in the same directory as the makefile though? You gotta say tests/debug.config if it's in there.

@dnldd
Copy link
Author

dnldd commented May 31, 2014

Yes they are in the same directory. The config has param "roadsigns" in there which I try getting in init_per_group/2 with ct:get_config(roadsigns) and it keeps returning undefined.

@essen
Copy link
Member

essen commented May 31, 2014

I think the -config option is for specifying the sys.config file. Can you try with -ct_config instead?

@dnldd
Copy link
Author

dnldd commented May 31, 2014

Yeah just tried it, didn't work either. I must be messing up somewhere else. I'm loading the config just so I can set it as the app env in init_per_group/2. Perhaps I'm going about that wrong.
init_per_group(roadsigns_api, Config) -> RSConfig = ct:get_config(roadsigns), application:ensure_all_started(roadsigns), application:set_env(roadsigns, roadsigns, RSConfig), .

Here is a snippet of the config:
[ { roadsigns, [ { cowboy_port, 8080 }, { cowboy_listeners, 100 }, { emysql_pool_size, 10 }, … ]} ]

@essen
Copy link
Member

essen commented May 31, 2014

Well I don't really know, never used that myself. You'll have better luck on erlang-questions.

@dnldd
Copy link
Author

dnldd commented May 31, 2014

Ok, I'm on it. Will post what I find here. Thanks for the help @essen

@dnldd
Copy link
Author

dnldd commented Jun 2, 2014

It seems the default config from the app takes precedence over whatever config is set via CT_OPTS. I'm also getting noproc errors for functions that run just fine in the release.

@dnldd
Copy link
Author

dnldd commented Jun 2, 2014

Finally got it to work, I used CT_OPTS = -erl_args -pa ebin -pa deps/*/ebin -smp -boot start_sasl ${ERL_ARGS} -config ./test/debug.config -name ${PROJECT}@hostname -s ${PROJECT}. Setting the config via erl_args solved it.

@dnldd dnldd closed this as completed Jun 2, 2014
@rlipscombe
Copy link
Contributor

CT_OPTS = -erl_args -config test/app.config was sufficient in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants