Skip to content

Conversation

@jonpspri
Copy link
Contributor

Description

When the various action controllers were spun out into their own repositories, they took their test suites with them. However, the original source code for the test suites was left in incubator-openwhisk . That was fine until we started compiling JAR files to support testing and leaving them in local maven. Now the JAR files including the actionController tests can create classpath conflicts with the test being compiled from the individual runtimes, challenging the validity of the tests.

This PR deletes the not-canonical versions of the tests from incubator-runtime. There are certain utility classes that are duplicated among the runtime repos that should maybe eventually be factored further into an SDK, but for the moment simplicity in the test process is needed to ensure test validity.

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@rabbah
Copy link
Member

rabbah commented Mar 20, 2018

We will need to designate a single place as the canonical root for the common code. Maybe it can still be this repo.

@jonpspri
Copy link
Contributor Author

Maybe it can be, but should we move it into a different namespace from the runtime-specific code (maybe also out of the tests directory since it will at that point be more of a library)? That would reduce the likelihood of collisions and make it clear when a given runtime has migrated to the new paradigm (whatever that may be).

@jonpspri jonpspri changed the title Remove actionControllers tests from incubator-openwhisk repo WIP: Remove actionControllers tests from incubator-openwhisk repo Mar 21, 2018
@jonpspri
Copy link
Contributor Author

Marking as WIP because apparently, the what’s in the runtime repo and what’s in the core repo was even more messy than I originally anticipated. Currently moving in the direction of “Make the runtimes self-sufficient for actionContainer.* classes”, then I’ll figure out what to factor back into the common libraries.

@jonpspri jonpspri changed the title WIP: Remove actionControllers tests from incubator-openwhisk repo Remove actionControllers tests from incubator-openwhisk repo Mar 22, 2018
@jonpspri
Copy link
Contributor Author

Removing the WIP tag, because I’ve resolved the namespace oversights as I’ve moved through the runtimes. It’s necessary to go through the tests in individual runtimes and make sure all are namespaced to package runtimes.actionContainers. There were a couple oversights in the master build chain for runtimes (e.g. Java) that should start breaking in Travis builds once this change is committed. I’ll try to file PRs for pre-emotive strikes on those.

A transition period will be needed to remove deploy builds from the Travis files, after which the shared classes can be factored back into incubator-openwhisk. Or maybe we’ll do that first. Too many repos and moving parts — time to put some stakes in the ground.

@rabbah
Copy link
Member

rabbah commented Mar 22, 2018

Too many repos

blame @csantanapr 😅

@rabbah
Copy link
Member

rabbah commented Mar 22, 2018

@jonpspri can you clarify: where will the canonical common code be located after this patch?

@csantanapr
Copy link
Member

Common test code should live in this repo for now.

I started refactoring the runtimes repo to not have a copy of this code and leverage the common-test jar produced by maven and installed locally.

Copy link
Member

@csantanapr csantanapr left a comment

Choose a reason for hiding this comment

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

Common test code lives in this repo for now and gets compiled into OpenWhisk-common-tests

@jonpspri
Copy link
Contributor Author

jonpspri commented Mar 24, 2018

@csantanapr @rabbah

To be precise, these are the modules of concern (all from tests/src/test/scala/actionContainers):

  • ActionContainer.scala
  • ActionProxyContainerTests.scala (?)
  • ResourceHelpers.scala

I think there's a path to moving them into one of the shared libraries, but it will require a little extra juggling with all the other changes impact them. Let me think about it for a bit.

Also, I'm a bit confused. I see 'openwhisk-common' and 'openwhisk-tests' in the maven local repositories. Are you suggesting another JAR 'openwhisk-common-tests' or a namespace in one of the existing JARs?

@jonpspri
Copy link
Contributor Author

Naming WIP again. I intend to find a home for at least ActionContainer.scala and ResourceHelpers.scala in the incubator-openwhisk repository.

@jonpspri
Copy link
Contributor Author

@csantanapr @rabbah Please review. Moving ActionContainer and ResourceHelpers into a 'common.actionContainers' package in the test library seemed to me to be the least disruptive course toward the shared library we're all looking for.

Now each runtime will need to 'import common.actionContainers._' and remove the redundant scala from the local repo. Thoughts?

Copy link
Member

@rabbah rabbah left a comment

Choose a reason for hiding this comment

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

LGTM modulo one small change.

testLargeInput(stdLargeInputSamples)
}

trait BasicActionRunnerTests extends ActionProxyContainerTestUtils {
Copy link
Member

Choose a reason for hiding this comment

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

@jonpspri can you moe this trait to the common package also - this is a boilerplate to run a few standard tests as shown just above on lines 243-247.

@rabbah
Copy link
Member

rabbah commented Mar 26, 2018

actually I think tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala can be made more generic and moved to the common package. The idea being that if one wants to test a specific runtime, they can specify the docker image name and some code samples, leaving the rest of the suite the same.

I can work with you seperately on making this trait the base of all the other runtime tests.

@jonpspri
Copy link
Contributor Author

Yeah, I ran across the trait in question in a couple places during my works on the runtimes. For the moment, I'll factor it over into ActionContainers.scala, which is where the other traits used by the tests live. I also want to break the hard dependency on whisk.properties that's in there. WIll probably post in a few hours.

@jonpspri
Copy link
Contributor Author

jonpspri commented May 5, 2018

Also tinkering with how the Docker URL is discovered, because the newer runtime build Gradles know their Docker hosts and can provide them as part of the environment.

@codecov-io
Copy link

codecov-io commented May 5, 2018

Codecov Report

Merging #3467 into master will increase coverage by 0.54%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3467      +/-   ##
==========================================
+ Coverage   74.11%   74.66%   +0.54%     
==========================================
  Files         127      127              
  Lines        6043     6051       +8     
  Branches      388      388              
==========================================
+ Hits         4479     4518      +39     
+ Misses       1564     1533      -31
Impacted Files Coverage Δ
...ain/scala/whisk/core/containerpool/HttpUtils.scala 47.27% <0%> (-44.22%) ⬇️
.../scala/src/main/scala/whisk/core/entity/Exec.scala 83.11% <0%> (-0.65%) ⬇️
...cala/src/main/scala/whisk/http/ErrorResponse.scala 89.77% <0%> (+1.13%) ⬆️
...on/scala/src/main/scala/whisk/common/Logging.scala 87.35% <0%> (+1.14%) ⬆️
...ain/scala/whisk/core/entity/ActivationResult.scala 92.3% <0%> (+1.53%) ⬆️
...in/scala/whisk/utils/ExecutionContextFactory.scala 100% <0%> (+7.69%) ⬆️
...rc/main/scala/whisk/core/entity/ExecManifest.scala 96.34% <0%> (+14.63%) ⬆️
...whisk/connector/kafka/KafkaConsumerConnector.scala 58.33% <0%> (+22.91%) ⬆️
...whisk/connector/kafka/KafkaProducerConnector.scala 58.33% <0%> (+36.11%) ⬆️
...whisk/connector/kafka/KafkaMessagingProvider.scala 88.46% <0%> (+65.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 583b154...b601f70. Read the comment docs.

@rabbah
Copy link
Member

rabbah commented Jun 6, 2018

@csantanapr I rebased this PR and resolved the conflict. I believe the latest changes address your concerns as well.

@rabbah rabbah added testing reviewed Review for this PR is finished. It is mergeable from a review's perspective. labels Jun 6, 2018
@rabbah rabbah self-assigned this Jun 6, 2018
Copy link
Member

@csantanapr csantanapr left a comment

Choose a reason for hiding this comment

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

don't want to be force to have a whisk.properties file

Option(WhiskProperties.getProperty("whisk.version.name")).filter(_.toLowerCase.contains("mac")).map {
case _ => s"tcp://${WhiskProperties.getMainDockerEndpoint}"
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this, I don't want the runtimes test to rely on WhiskProperties to have a whisk.properties file present.
If user is using docker-machine the DOCKER_HOST env variable needs to be set and use.

Copy link
Member

Choose a reason for hiding this comment

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

it's a nice convenience - the precedence order is -D, ENV, then whisk props.

@rabbah rabbah mentioned this pull request Jun 8, 2018
20 tasks
@akrabat akrabat mentioned this pull request Jun 8, 2018
20 tasks
@csantanapr
Copy link
Member

PG 5 374 👍

@csantanapr csantanapr merged commit d041a8e into apache:master Jun 9, 2018
@chetanmeh
Copy link
Member

chetanmeh commented Jun 11, 2018

With this change travis build time for unit test now reduces to 18 mins (from 24 mins) of which test run is only ~6 mins!

image

@rabbah rabbah mentioned this pull request Jun 11, 2018
20 tasks
remore added a commit to remore/incubator-openwhisk that referenced this pull request Jun 11, 2018
BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
@jonpspri jonpspri deleted the rm-actioncontainer-tests branch April 19, 2020 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed Review for this PR is finished. It is mergeable from a review's perspective. testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants