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

fix(build): Fix E2E tests #1526

Merged
merged 17 commits into from
Nov 26, 2019
Merged

fix(build): Fix E2E tests #1526

merged 17 commits into from
Nov 26, 2019

Conversation

benjamingeer
Copy link

@benjamingeer benjamingeer commented Nov 20, 2019

  • Fix e2e-tests-with-coverage target in Makefile.
  • Don't check collection types in InstanceChecker.
  • Give InstanceChecker access to the non-standard names of certain JSON properties.
  • Update test data for:
    • ResourcesRouteV2E2ESpec
    • InstanceCheckerSpec
  • Fix ClientApiRouteE2ESpec to load anything-data.ttl, now needed for client code generation.
  • Add E2E tag to E2E specs that didn't have it.
  • Use IIIF_BASE_URL placeholder in E2E test files, because the Sipi URL is different when tests are run in Docker.
  • Ignore tests that create large texts, because they use too much memory for GitHub CI.

Fixes #1525.

@benjamingeer benjamingeer added this to the 2019-11 milestone Nov 20, 2019
@benjamingeer benjamingeer self-assigned this Nov 20, 2019
@benjamingeer benjamingeer mentioned this pull request Nov 20, 2019


protected def singleAwaitingRequest(request: HttpRequest, duration: Duration = 5999.milliseconds): HttpResponse = {
protected def singleAwaitingRequest(request: HttpRequest, duration: Duration = 7999.milliseconds): HttpResponse = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just in case you wonder why this odd number. It is easier to find the correct setting that needs to be tweaked. The timeout output is often not clear where it happened.

@@ -105,6 +105,52 @@
"@value" : "http://0.0.0.0:3336/ark:/72163/1/0001/H6gBWUuJSuuO=CilHV8kQwk/bXMwnrHvQH2DMjOFrGmNzgz.20180528T155203897Z"
}
},
"anything:hasGeometry" : {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume these values were introduced in #1514 but since the e2e tests were not run the difference in the test data was not detected.

@benjamingeer
Copy link
Author

I assume these values were introduced in #1514 but since the e2e tests were not run the difference in the test data was not detected.

Actually, what happened is that at some point we added ARK URLs and UUIDs to values. After that, some hard-coded data that was supposed to fail validation (e.g. it had a boolean property with a string object, to check whether InstanceChecker would notice) started to fail validation because the hard-coded values in the test didn’t contain ARK URLs or UUIDs. So I had to add ARK UURLs and UUIDs to those values, to make them fail validation for the right reasons.

@benjamingeer
Copy link
Author

@subotic I don't understand what's happening. It does:

Setting up npm (3.5.2-0ubuntu4) ...

But then it says:

java.io.IOException: Cannot run program "npm" (in directory "/tmp/clientapi18252897938348417182/src"): error=2, No such file or directory

There is also this strange error, as if GraphDB sent a header saying that its response would be in GZIP format but the client couldn't unpack the file:

java.util.zip.ZipException: Not in GZIP format
2679
	at java.base/java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:166)
2680
	at java.base/java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:80)
2681
	at java.base/java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:92)
2682
	at org.apache.http.client.entity.GZIPInputStreamFactory.create(GZIPInputStreamFactory.java:61)
2683
	at org.apache.http.client.entity.LazyDecompressingInputStream.initWrapper(LazyDecompressingInputStream.java:51)
2684
	at org.apache.http.client.entity.LazyDecompressingInputStream.read(LazyDecompressingInputStream.java:69)
2685
	at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
2686
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
2687
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
2688
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:185)
2689
	at java.base/java.io.Reader.read(Reader.java:144)
2690
	at org.apache.http.util.EntityUtils.toString(EntityUtils.java:227)
2691
	at org.apache.http.util.EntityUtils.toString(EntityUtils.java:308)
2692
	at org.knora.webapi.store.triplestore.http.HttpTriplestoreConnector.$anonfun$getSparqlHttpResponse$1(HttpTriplestoreConnector.scala:662)
2693
	at scala.util.Try$.apply(Try.scala:213)
2694
	at org.knora.webapi.store.triplestore.http.HttpTriplestoreConnector.getSparqlHttpResponse(HttpTriplestoreConnector.scala:652)

@benjamingeer
Copy link
Author

When I run all the tests outside Docker, they all pass.

@benjamingeer
Copy link
Author

benjamingeer commented Nov 22, 2019

When I run the tests locally using make e2e-tests, is there a way to stop them? I tried Control-C, but it didn't have any effect, the tests kept running. I looked in the Docker Desktop menu but didn't find anything for stopping containers. I tried installing Kitematic, but it doesn't show any local containers either. I ended up finding the sbt process ID and using kill -9.

@subotic
Copy link
Collaborator

subotic commented Nov 22, 2019

When I run all the tests outside Docker, they all pass.

Then npm is missing inside the Docker container. I will add it to the image.

When I run the tests using make e2e, is there a way to stop them?

No, the only way would be to kill the created api container from terminal:

$ docker container ls
$ docker container rm <container_id> // you could try 'api' as the container_id

@subotic
Copy link
Collaborator

subotic commented Nov 22, 2019

I've updated the Docker image and restarted the tests. Let's see if this all that is needed.

@benjamingeer
Copy link
Author

I've updated the Docker image

So do we still need this in main.yml?

      - name: install requirements
        run: sudo apt-get install nodejs npm

@subotic
Copy link
Collaborator

subotic commented Nov 22, 2019

I've updated the Docker image

So do we still need this in main.yml?

      - name: install requirements
        run: sudo apt-get install nodejs npm

I don't think so.

@benjamingeer
Copy link
Author

OMG the tests passed!

@benjamingeer
Copy link
Author

Now it's failing because of this:

Triplestore responded with HTTP code 500:
Query evaluation error:
Insufficient free Heap Memory 240Mb for group by and distinct, threshold:250Mb, reached 0Mb (HTTP status 500)

@subotic
Copy link
Collaborator

subotic commented Nov 22, 2019

Now it's failing because of this:

Triplestore responded with HTTP code 500:
Query evaluation error:
Insufficient free Heap Memory 240Mb for group by and distinct, threshold:250Mb, reached 0Mb (HTTP status 500)

Which test changed after the merge? GraphDB doesn't have enough memory.

@benjamingeer
Copy link
Author

Which test changed after the merge? GraphDB doesn't have enough memory.

No tests changed, it was the merge of #1527. Can we give GraphDB more memory?

@benjamingeer
Copy link
Author

@subotic Does this mean we can't use GitHub CI?

@subotic
Copy link
Collaborator

subotic commented Nov 26, 2019

Which test changed after the merge? GraphDB doesn't have enough memory.

No tests changed, it was the merge of #1527. Can we give GraphDB more memory?

I don‘t think so.

Does this mean we can't use GitHub CI?

This means that we need to find a way how it can work with Github CI. Unfortunately, there is no alternative. After doing some calculations, running it on our own hardware is not feasible cost wise.

We could try and isolate the high memory tests with a HighMemory test tag and run them separately?

@benjamingeer
Copy link
Author

OK the tests that use a lot of memory are the ones that create large texts with lots of standoff. I think we don't really need to run these in CI anyway, so I set them to ignore. Otherwise everything seems to work. Can we merge this?

Copy link
Collaborator

@subotic subotic left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM :-)

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.

Makefile not running the right tests
3 participants