apache/openwhisk-runtime-dotnet

What's the correct way to run tests against basic openwhisk and a new runtime?

paul42 opened this issue · 6 comments

Hey everyone, I'm working on getting .net6.0 working and I'm not used to gradle unfortunately - when I run it in the openwhisk-runtime-dot as gradle build I get an error about compileTestScala:

I'm running this on my ubuntu 18.04 WSL2 terminal.

my thought is that I need to get all the tests to run against the basic openwhisk repo, but when I run that I get lots of tests failing with initializationError are there any docs around about how to get the tests to build/compile/pass for the basic openwhisk repo and then how to do so for a new runtime?

Do you have to have openwhisk running in standalone mode to have the gradle build pass?

Output of dotnet runtime's gradle build

> Task :tests:compileTestScala FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tests:compileTestScala'.
> Could not resolve all files for configuration ':tests:testCompileClasspath'.
   > Could not find org.apache.openwhisk:openwhisk-tests:1.0.0-SNAPSHOT.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/org/apache/openwhisk/openwhisk-tests/1.0.0-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/org/apache/openwhisk/openwhisk-tests/1.0.0-SNAPSHOT/openwhisk-tests-1.0.0-SNAPSHOT.pom
       - https://repo.maven.apache.org/maven2/org/apache/openwhisk/openwhisk-tests/1.0.0-SNAPSHOT/openwhisk-tests-1.0.0-SNAPSHOT-tests.jar
       - file:/home/paul42/.m2/repository/org/apache/openwhisk/openwhisk-tests/1.0.0-SNAPSHOT/maven-metadata.xml
       - file:/home/paul42/.m2/repository/org/apache/openwhisk/openwhisk-tests/1.0.0-SNAPSHOT/openwhisk-tests-1.0.0-SNAPSHOT.pom
       - file:/home/paul42/.m2/repository/org/apache/openwhisk/openwhisk-tests/1.0.0-SNAPSHOT/openwhisk-tests-1.0.0-SNAPSHOT-tests.jar
     Required by:
         project :tests

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 25s
26 actionable tasks: 25 executed, 1 up-to-date

lots of errors in the test file for the gradle build in the openwhisk repo:
java.lang.AssertionError: could not determine openwhisk home etc.

some notes:

  • use gradlew to use the wrapper instead of your system's gradle
  • use gradlew and run ./gradlew install in primary openstack directory
  • do a docker pull on all files (like openwhisk/action-dotnet2.2) and then docker tag them: docker tag openwhisk/action-dotnet-v2.2 action-dotnet-v2.2 so they are 'local'
    so far got the existing tests to pass, now I just need to debug why my container is failing

I typically run ./gradlew install in primary openstack directory then in the runtime directly, run ./gradlew distDocker to build the local image and then test to run the tests. You shouldn't need to apply tags manually.

@rabbah do you know if there's a way to tweak the scala action containers so they don't delete the docker container after a run? I'd like to look at the logs if possible of the docker container, but there's nothing there when I run my docker ps -a

also what IDE do you recommend for scala? I'd like to learn more about how to run these tests 😅
specifically in the scala tests, there's code like

package actionContainers

import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import common.WskActorSystem
import spray.json._
import actionContainers.ActionContainer.withContainer
import java.nio.file.Paths

is it possible to see those base imports?
class DotNet6_0ActionContainerTests extends BasicActionRunnerTests with WskActorSystem I'm guessing if I could change how it sends the docker run command I might be able to keep the container around without deletion and then review the logs, possibly. I might just have to build my own test harness with base64 encoded test project and debug myself

@rabbah do you know if there's a way to tweak the scala action containers so they don't delete the docker container after a run? I'd like to look at the logs if possible of the docker container, but there's nothing there when I run my docker ps -a

For this, it's probably more convenient for you to use invoke.py to manually start the container, init and run against it. You'll se the logs on the console.

I use IntelliJ for Scala dev.

The imports like actionContainers.ActionContainer.withContainer are coming from the main openwhisk repo, which is why you run the snapshot/install build first. You can if you like copy those files over and have them available locally, then you can modify the code and not destroy the container after a test - look at the withContainer wrapper for that.

thanks for the advice I was able to debug locally and found my issue, thanks for the guidance!