winterstein / sogive-app

The SoGive user app - See your impact
Other
2 stars 5 forks source link

Updated tests to use new runtest with server production check, fixing the broken tests #206

Closed dodo721 closed 4 years ago

winterstein commented 4 years ago

Hello @DanielRobertAppel - Could you test this? And then merge it into master provided its fine. Oh - and propagate edits into wwappbase.js/template. Thanks, Dan

DanielRobertAppel commented 4 years ago

Hello,

when in ~/winterwell/sogive-app when on branch test-updates when running: node runtest.js --site test

The target URL for the gitlog.txt is erroneously https://testapp.sogive.org/build/gitlog.txt

When it should be https://test.sogive.org/build/gitlog.txt

anitawoodruff commented 4 years ago

When I run this with node runtest.js --site local, I get:

Checking gitlog for host type...
{ FetchError: maximum redirect reached at: https://as.good-loop.com/apage.html
    at ClientRequest.<anonymous> (/home/anita/repos/sogive/sogive-app/node_modules/node-fetch/lib/index.js:1504:15)
    at ClientRequest.emit (events.js:198:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17)
    at TLSSocket.socketOnData (_http_client.js:451:20)
    at TLSSocket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at TLSSocket.Readable.push (_stream_readable.js:224:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:94:17)
  message:
   'maximum redirect reached at: https://as.good-loop.com/apage.html',
  type: 'max-redirect' }
Could not get gitlog (error above). Continue? (y/n)
dodo721 commented 4 years ago

Hi there, @DanielRobertAppel the build path should be correct, working on my end - if not, it can be changed in runtestconfig.js. I will write documentation up for it soon. @anitawoodruff that error is occurring because there is no gitlog.txt - for some reason this is the error thrown when the gitlog.txt can't be fetched. You can see at the bottom it provides an override if you want to continue anyway. To generate a gitlog.txt, run npm run compile

dodo721 commented 4 years ago

Note: Getting gitlog.txt is not essential, hence the override - but with @DanielRobertAppel 's new gitstamp.sh the gitlog will provide the info needed to check if the server is production, so any apps using this updated version should run the check succesfully. I can confirm sogive is one of those apps. Also, sorry for getting back to this so late - don't know why i missed it initially

anitawoodruff commented 4 years ago

ok I tried running npm run compile and it completed successfully, ending with the message Wrote git manifest: web/build/gitlog.txt. However I still get the same error as above when I run node runtest.js --site local (or node runtest.js), and a slightly different one when I run node runtest.js --site test:

Checking gitlog for host type...
{ FetchError: request to https://testapp.sogive.org/build/gitlog.txt failed, reason: Hostname/IP does not match certificate's altnames: Host: testapp.sogive.org. is not in the cert's altnames: DNS:*.good-loop.com
    at ClientRequest.<anonymous> (/home/anita/repos/sogive/sogive-app/node_modules/node-fetch/lib/index.js:1461:11)
    at ClientRequest.emit (events.js:198:13)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  message:
   'request to https://testapp.sogive.org/build/gitlog.txt failed, reason: Hostname/IP does not match certificate\'s altnames: Host: testapp.sogive.org. is not in the cert\'s altnames: DNS:*.good-loop.com',
  type: 'system',
  errno: 'ERR_TLS_CERT_ALTNAME_INVALID',
  code: 'ERR_TLS_CERT_ALTNAME_INVALID' }
Could not get gitlog (error above). Continue? (y/n)

The contents of web/build/gitlog.txt are:

HOST:   cogwheel
##
On branch bens-test-updates
nothing to commit, working tree clean
commit 5b5c95ade4de6027d3502e1b7ddb099d44fe2260
Author: BDurkin <ben@good-loop.com>
Date:   Mon Oct 12 15:05:39 2020 +0100

    Updated tests to use new runtest with server production check
=======================
## wwappbase.js
branch
  fix-sogive-tests
* master
  rename-impact-calculator
commit f71a39ac30ddf9c931e8600a3d57e29995798c33
Author: Daniel Winterstein <daniel@good-loop.com>
Date:   Sun Oct 25 20:40:21 2020 +0000

    wider-textarea

It's true I can press 'y' to continue so this isn't blocking me from writing a new test, but it would be good to solve the mystery.

Thanks!

winterstein commented 4 years ago

Hello @DanielRobertAppel - Could you lead on this branch? Thanks :)

DanielRobertAppel commented 4 years ago

@dodo721

https://github.com/winterstein/sogive-app/pull/206#issuecomment-708320052 --> this is the cause of "why people can't get the gitlog.txt"

IN : runtestconfig.js ON : line number 2 change to : appURL: ".sogive.org", ON : linue number 5 change to : site: 'test',

then the tests run as intended.

dodo721 commented 4 years ago

I have made updates to the runtest script. Sorry @DanielRobertAppel for not reading your previous comment properly: it was pointing to the wrong URL. The runtest script needed a bit of modification to handle the URLs that have no other prefix properly, should now work. There is no need to change site to test in the config. That can be done via node runtest.js --site test Should work now.

DanielRobertAppel commented 4 years ago

Nice one.

The tests now all work as intended.