gratipay / gratipay.com

Here lieth a pioneer in open source sustainability. RIP
https://gratipay.news/the-end-cbfba8f50981
MIT License
1.12k stars 308 forks source link

fix travis #3025

Closed chadwhitacre closed 9 years ago

chadwhitacre commented 9 years ago

Travis is failing on #3011 and #3020 with this error:

$ make test
env/bin/honcho -e defaults.env,tests/test.env,tests/local.env run ./recreate-schema.sh
==============================================================================
Recreating public schema ... 
psql: FATAL:  database "travis" does not exist
make: *** [test-schema] Error 2
The command "make test" exited with 2.
Done. Your build exited with 1.

What's up? IRC

chadwhitacre commented 9 years ago

It looks like it's not picking up the database configuration and it's using a default (travis).

One idea I had is that the test deps update (#3017) updated honcho: we're using a fork. That doesn't pan out though. Other hypotheses?

chadwhitacre commented 9 years ago

http://docs.travis-ci.com/user/using-postgresql/

chadwhitacre commented 9 years ago

From the Travis log it looks like the problem is coming from this line:

echo "DROP SCHEMA public CASCADE" | psql $DATABASE_URL

So DATABASE_URL is not getting set properly?

chadwhitacre commented 9 years ago

Today we're happy to announce our new build infrastructure

http://blog.travis-ci.com/2014-12-17-faster-builds-with-container-based-infrastructure/

chadwhitacre commented 9 years ago

Not relevant. The new infrastructure is opt-in, and we haven't opted in.

chadwhitacre commented 9 years ago

I'm going to push commits to #3011 to debug the problem. I'll force-push those off once I'm done.

chadwhitacre commented 9 years ago

Yes, DATABASE_URL is empty inside recreate-schema.sh.

chadwhitacre commented 9 years ago

Hypothesis: DATABASE_URL is not set properly in the env files. Test: cat the env files and inspect them.

chadwhitacre commented 9 years ago

Here's the env files:

https://travis-ci.org/gratipay/gratipay.com/builds/44458444

defaults
====================
DATABASE_URL="dbname=gratipay"
[snip]

tests/test.env
====================
DATABASE_URL="dbname=gratipay-test"
CANONICAL_HOST=
UPDATE_HOMEPAGE_EVERY=0
CHECK_DB_EVERY=0
RAISE_CARD_EXPIRATION=yes
GRATIPAY_CACHE_STATIC=yes

tests/local.env
====================
DATABASE_URL=dbname=gratipay
chadwhitacre commented 9 years ago

Hypothesis: Nothing whatsoever from the env files make it into recreate-schema.sh. Test: Output something besides DATABASE_URL.

chadwhitacre commented 9 years ago

Hypothesis: The lack of quotes in DATABASE_URL=dbname=gratipay in tests/local.env is causing the problem. Test: Add quotes.

chadwhitacre commented 9 years ago

Nothing whatsoever from the env files make it into recreate-schema.sh.

Well, I effed up the tracer in tests/local.env, but the results are nonetheless conclusive: the hypothesis is confirmed!

rohitpaulk commented 9 years ago

Hypothesis: The lack of quotes in DATABASE_URL=dbname=gratipay in tests/local.env is causing the problem.

None of the tracers are getting picked up.

chadwhitacre commented 9 years ago

What he said. :-)

rohitpaulk commented 9 years ago

Oops, didnt' see the above comment.

chadwhitacre commented 9 years ago

IRC

chadwhitacre commented 9 years ago

Yoiks. We can see envvars from the base environment, just nothing from our env files. Makes it sound like a honcho problem, but we do seem to be using the same version locally and at Travis. What gives?

chadwhitacre commented 9 years ago

We retried several previously passing commits, and they fail. @rohitpaulk is pinging Travis. IRC

rohitpaulk commented 9 years ago

Python was upgraded from 2.7.8 to 2.7.9 earlier this week

Changaco commented 9 years ago

After upgrading to python 2.7.9 tests are failing for me:

tests/py/test_anonymous_json.py:4: in <module>
    from gratipay.testing import Harness
gratipay/testing/__init__.py:55: in <module>
    class Harness(unittest.TestCase):
gratipay/testing/__init__.py:57: in Harness
    client = ClientWithAuth(www_root=WWW_ROOT, project_root=PROJECT_ROOT)
gratipay/testing/__init__.py:31: in __init__
    Client.website = Client.hydrate_website(self)
env/lib/python2.7/site-packages/aspen/testing/client.py:66: in hydrate_website
    self._website = Website(argv)
env/lib/python2.7/site-packages/aspen/website.py:35: in __init__
    self.configure(argv)
env/lib/python2.7/site-packages/aspen/configuration/__init__.py:295: in configure
    self.run_config_scripts()
env/lib/python2.7/site-packages/aspen/configuration/__init__.py:338: in run_config_scripts
    execfile(filepath, {'website': self})
configure-aspen.py:64: in <module>
    env = website.env = gratipay.wireup.env()
gratipay/wireup.py:429: in env
    raise BadEnvironment("Missing envvar{}: {}.".format(plural, keys))
E   BadEnvironment: Missing envvars: BALANCED_API_SECRET, BITBUCKET_CALLBACK, BITBUCKET_CONSUMER_KEY, BITBUCKET_CONSUMER_SECRET, BOUNTYSOURCE_API_HOST, BOUNTYSOURCE_API_SECRET, BOUNTYSOURCE_CALLBACK, BOUNTYSOURCE_WWW_HOST, CANONICAL_HOST, CANONICAL_SCHEME, CHECK_DB_EVERY, DATABASE_MAXCONN, DATABASE_URL, FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, FACEBOOK_CALLBACK, GITHUB_CALLBACK, GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GOOGLE_ANALYTICS_ID, GOOGLE_CALLBACK, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GRATIPAY_ASSET_URL, GRATIPAY_CACHE_STATIC, GRATIPAY_COMPRESS_ASSETS, GUNICORN_OPTS, LOG_METRICS, MANDRILL_KEY, NANSWERS_THRESHOLD, OPENSTREETMAP_API_URL, OPENSTREETMAP_AUTH_URL, OPENSTREETMAP_CALLBACK, OPENSTREETMAP_CONSUMER_KEY, OPENSTREETMAP_CONSUMER_SECRET, OPTIMIZELY_ID, RAISE_CARD_EXPIRATION, SENTRY_DSN, TWITTER_CALLBACK, TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, UPDATE_GLOBAL_STATS_EVERY, VENMO_CALLBACK, VENMO_CLIENT_ID, VENMO_CLIENT_SECRET.
Changaco commented 9 years ago

It's clear that honcho is silently failing to inject the variables into the env.

Changaco commented 9 years ago

nickstenning/honcho#121