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

TEST: Fix test task invocation #31657

Merged
merged 2 commits into from
Jun 29, 2018

Conversation

original-brownbear
Copy link
Member

@original-brownbear original-brownbear commented Jun 28, 2018

./gradlew test was broken by 8557bba.

Fails with:

FAILURE: Build failed with an exception.

* What went wrong:
Found the 1 `test` tasks:
  :client:benchmark:test -> class org.gradle.api.tasks.testing.Test_Decorated

on master

I think simply removing the test task fixes things though (should be ok now since that commit made the test replace action hard against missing test tasks right?).

@original-brownbear original-brownbear added the :Delivery/Build Build or test infrastructure label Jun 28, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@@ -47,8 +47,7 @@ mainClassName = 'org.elasticsearch.client.benchmark.BenchmarkMain'

// never try to invoke tests on the benchmark project - there aren't any
check.dependsOn.remove(test)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for missing this.
I handled a similar case in RandomizedTestingPlugin.replaceTestTask, note that the line above that removes it from check doesn't work reliably either. I think you might be better off with test.enabled = false

Copy link
Member Author

Choose a reason for hiding this comment

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

@atorok np, let me try that. Seems my approach doesn't work after all. It fixes test but some naming check fails now (likely because the replacement didn't actually happen now).

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that the same naming test that's going on in CI ?

Copy link
Member Author

@original-brownbear original-brownbear Jun 28, 2018

Choose a reason for hiding this comment

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

@atorok ci failed with:
https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+pull-request/12497/console

16:07:37 Starting process 'Gradle Test Executor 2'. Working directory: /var/lib/jenkins/workspace/elastic+elasticsearch+pull-request/distribution/bwc/next-minor-snapshot/build/bwc/checkout-6.x/buildSrc Command: /var/lib/jenkins/.java/oracle-10+46-linux/bin/java -Dorg.gradle.native=false @/tmp/gradle-worker-classpath1600404273191648248txt -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -ea worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 2'
16:07:37 Successfully started process 'Gradle Test Executor 2'
16:07:51 
16:07:51 org.elasticsearch.gradle.precommit.NamingConventionsTaskIT > testNameCheckFailsAsItShouldWithMain FAILED
16:07:51     java.lang.AssertionError: expected:  'Classes ending with [Tests] or [IT] or extending [UnitTestCase] must be in src/test/java:' but it was not found in the output
16:07:51         at __randomizedtesting.SeedInfo.seed([932913760A8CAE23:BE1DB584958467F5]:0)
16:07:51         at org.junit.Assert.fail(Assert.java:88)
16:07:51         at org.junit.Assert.assertTrue(Assert.java:41)
16:07:51         at org.elasticsearch.gradle.precommit.NamingConventionsTaskIT.testNameCheckFailsAsItShouldWithMain(NamingConventionsTaskIT.java:65)
16:07:56 
16:07:56 org.elasticsearch.gradle.precommit.NamingConventionsTaskIT > testNameCheckFailsAsItShould FAILED
16:07:56     java.lang.AssertionError: expected:  'Found inner classes that are tests, which are excluded from the test runner:' but it was not found in the output
16:07:56         at __randomizedtesting.SeedInfo.seed([932913760A8CAE23:BD0BAE6730164B25]:0)
16:07:56         at org.junit.Assert.fail(Assert.java:88)
16:07:56         at org.junit.Assert.assertTrue(Assert.java:41)
16:07:56         at org.elasticsearch.gradle.precommit.NamingConventionsTaskIT.testNameCheckFailsAsItShould(NamingConventionsTaskIT.java:40)
16:07:56 WARNING: An illegal reflective access operation has occurred
16:07:56 WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/var/lib/jenkins/.gradle/wrapper/dists/gradle-4.8.1-all/6fmj4nezasjg1b7kkmy10xgo2/gradle-4.8.1/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
16:07:56 WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
16:07:56 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
16:07:56 WARNING: All illegal access operations will be denied in a future release
16:07:56 
16:07:56 Gradle Test Executor 2 finished executing tests.
16:07:56 
16:07:56 
16:07:56 14 tests completed, 2 failed
16:07:56 
16:07:56 > Task :buildSrc:test FAILED
16:07:56 FAILURE: Build failed with an exception.
16:07:56 

on check when I just removed the test target. I now tried test.enabled=false (that def. fixed test locally for me, but not sure if it also fixes check)

@alpar-t
Copy link
Contributor

alpar-t commented Jun 28, 2018

LGTM. It will fix check as well the test task will be pulled in but skipped.

@original-brownbear
Copy link
Member Author

original-brownbear commented Jun 28, 2018

@atorok still breaks the same way unfortunately :( If I run the broken target in isolation it's green with this change, but check overall fails.

Probably some load order issue with the new org.gradle.api.tasks.TaskContainer#getByNameLater?

yea I found gradle/gradle#5730.

I'll try to look into this a little, but you probably know a lot more than me here :)

@original-brownbear
Copy link
Member Author

original-brownbear commented Jun 28, 2018

@original-brownbear
Copy link
Member Author

original-brownbear commented Jun 29, 2018

@atorok now it's green since the failing tests were muted in master. Still good to merge? (I'd vote yes, it's kinda nasty that this precludes running individual tests via Gradle atm and not all tests run straight from the IDE)

@alpar-t
Copy link
Contributor

alpar-t commented Jun 29, 2018

Yes, it's good to go, I think that test never played a role with this change other than preventing testing it.
I agree it's not ideal. This is how Gradle sets it up, but since we have buildSrc as a separate project I'll consider running the tests there.

@original-brownbear
Copy link
Member Author

@atorok ok thanks!

@original-brownbear original-brownbear merged commit 7a76e3a into elastic:master Jun 29, 2018
@original-brownbear original-brownbear deleted the fix-test-taks branch June 29, 2018 08:06
dnhatn added a commit that referenced this pull request Jun 29, 2018
* master:
  Do not check for object existence when deleting repository index files (#31680)
  Remove extra check for object existence in repository-gcs read object (#31661)
  Support multiple system store types (#31650)
  [Test] Clean up some repository-s3 tests (#31601)
  [Docs] Use capital letters in section headings (#31678)
  [DOCS] Add PQL language Plugin (#31237)
  Merge AzureStorageService and AzureStorageServiceImpl and clean up tests (#31607)
  TEST: Fix test task invocation (#31657)
  Revert "[TEST] Mute failing tests in NativeRealmInteg and ReservedRealmInteg"
  Fix RealmInteg test failures
  Extend allowed characters for grok field names (#21745) (#31653)
  [DOCS] Fix licensing API details (#31667)
  [TEST] Mute failing tests in NativeRealmInteg and ReservedRealmInteg
  Fix CreateSnapshotRequestTests Failure (#31630)
  Configurable password hashing algorithm/cost (#31234)
  [TEST] Mute failing NamingConventionsTaskIT tests
  [DOCS] Replace CONFIG_DIR with ES_PATH_CONF (#31635)
  Core: Require all actions have a Task (#31627)
jasontedor added a commit to martijnvg/elasticsearch that referenced this pull request Jul 1, 2018
* elastic/ccr: (30 commits)
  Enable setting client path prefix to / (elastic#30119)
  [DOCS] Secure settings specified per node (elastic#31621)
  has_parent builder: exception message/param fix (elastic#31182)
  TEST: Randomize soft-deletes settings (elastic#31585)
  Mute 'Test typed keys parameter for suggesters' as we await a fix.
  Build test: Thread linger
  Fix gradle4.8 deprecation warnings (elastic#31654)
  Mute FileRealmTests#testAuthenticateCaching with an @AwaitsFix.
  Mute TransportChangePasswordActionTests#testIncorrectPasswordHashingAlgorithm with an @AwaitsFix.
  Build: Fix naming conventions task   (elastic#31681)
  Introduce a Hashing Processor (elastic#31087)
  Do not check for object existence when deleting repository index files (elastic#31680)
  Remove extra check for object existence in repository-gcs read object (elastic#31661)
  Support multiple system store types (elastic#31650)
  [Test] Clean up some repository-s3 tests (elastic#31601)
  [Docs] Use capital letters in section headings (elastic#31678)
  muted tests that will be replaced by the shard follow task refactoring: elastic#31581
  [DOCS] Add PQL language Plugin (elastic#31237)
  Merge AzureStorageService and AzureStorageServiceImpl and clean up tests (elastic#31607)
  TEST: Fix test task invocation (elastic#31657)
  ...
rjernst pushed a commit that referenced this pull request Sep 18, 2018
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants