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

always use an empty pelias.json in test #1431

Merged
merged 1 commit into from
May 7, 2020
Merged

always use an empty pelias.json in test #1431

merged 1 commit into from
May 7, 2020

Conversation

blackmad
Copy link
Contributor

@blackmad blackmad commented May 7, 2020

I noticed that if I had a pelias.json in api/ or in ~/, it seemed like it would get used by tests and a couple of them would break because they were taking in some of my pelias configuration (other sources mostly).

To make unit tests always pass for developers, always point the unit test command at an empty pelias.json in test/

Closes #1239

package.json Outdated
@@ -15,7 +15,7 @@
"start": "./bin/start",
"test": "npm run unit",
"travis": "npm test",
"unit": "./bin/units",
"unit": "PELIAS_CONFIG=./test/pelias-config-empty.json ./bin/units",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually would work great in ./bin/units itself (I think). That way anyone who runs the unit tests through any mechanism would get the right PELIAS_CONFIG

@orangejulius
Copy link
Member

Ah yeah, we should have done this a long time ago. It looks like we need the actual empty pelias.json file, but otherwise we should absolutely merge this.

@orangejulius
Copy link
Member

I went in and fixed it all myself, and will take care of merging this from here. Thanks for not putting up with the cruft we've let sit for too long :P

@orangejulius orangejulius merged commit c12589a into pelias:master May 7, 2020
orangejulius added a commit that referenced this pull request Apr 1, 2021
This change resolves #1419 by
ensuring all unit tests will run with the `api.targets.auto_discover`
property set to false, even if the value of that property in the
`pelias-config` defaults or `~/pelias.json` is set to true.

There were two changes required to achieve this:

First, expand upon the work in #1431
that added an empty `pelias.json` file for use in the unit tests. Its
now no longer empty and includes setting `auto_discover` to false.

Second, one unit test still ended up calling Elasticsearch with that
change. It was a test for the `TypeMapping` module itself, and it was
overriding `pelias-config` with its own. Now with a test-specific
`pelias.json` file, that code can simply be removed, and the unit tests
can use the unmodified `pelias-config` library.

I tested these changes against pelias/config#127
to make sure that PR won't break anything, and I believe everything is
good to go.
orangejulius added a commit that referenced this pull request Apr 8, 2021
This change resolves #1419 by
ensuring all unit tests will run with the `api.targets.auto_discover`
property set to false, even if the value of that property in the
`pelias-config` defaults or `~/pelias.json` is set to true.

There were two changes required to achieve this:

First, expand upon the work in #1431
that added an empty `pelias.json` file for use in the unit tests. Its
now no longer empty and includes setting `auto_discover` to false.

Second, one unit test still ended up calling Elasticsearch with that
change. It was a test for the `TypeMapping` module itself, and it was
overriding `pelias-config` with its own. Now with a test-specific
`pelias.json` file, that code can simply be removed, and the unit tests
can use the unmodified `pelias-config` library.

I tested these changes against pelias/config#127
to make sure that PR won't break anything, and I believe everything is
good to go.

Closes #1419
orangejulius added a commit that referenced this pull request Apr 9, 2021
This change resolves #1419 by
ensuring all unit tests will run with the `api.targets.auto_discover`
property set to false, even if the value of that property in the
`pelias-config` defaults or `~/pelias.json` is set to true.

There were two changes required to achieve this:

First, expand upon the work in #1431
that added an empty `pelias.json` file for use in the unit tests. Its
now no longer empty and includes setting `auto_discover` to false.

Second, one unit test still ended up calling Elasticsearch with that
change. It was a test for the `TypeMapping` module itself, and it was
overriding `pelias-config` with its own. Now with a test-specific
`pelias.json` file, that code can simply be removed, and the unit tests
can use the unmodified `pelias-config` library.

I tested these changes against pelias/config#127
to make sure that PR won't break anything, and I believe everything is
good to go.

Closes #1419
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

Successfully merging this pull request may close these issues.

Autocomplete tests affected by pelias.json contents
2 participants