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

write the unit test for all the REST endpoints #1

Open
angleto opened this issue Nov 29, 2017 · 7 comments
Open

write the unit test for all the REST endpoints #1

angleto opened this issue Nov 29, 2017 · 7 comments

Comments

@angleto
Copy link
Member

angleto commented Nov 29, 2017

Every REST endpoint must be verified through the unit tests.
The code for the unit test is ready, they must only be extended to all the endpoints: currently only the index management endpoints is tested (see for example src/test/scala/io/elegans/orac/resources/IndexManagementResourceTest.scala).
The unit tests can be run using the command:

sbt dockerComposeUp ; sbt test ; sbt dockerComposeStop

The reference documentation for the API is: https://app.swaggerhub.com/apis/angleto/orac/v0.0.1#/customer/get_orac_user

@nyrk
Copy link

nyrk commented Dec 5, 2017

I am on it but, at the moment, I'm stuck on trying to solve some issues with sbt / docker...

@angleto
Copy link
Member Author

angleto commented Dec 5, 2017

Thanks @nyrk let me know if I can help.

@nyrk
Copy link

nyrk commented Dec 6, 2017

Fighting against the following error:

[alex@localhost]$ sbt 
scala.MatchError: false (of class scala.reflect.internal.Trees$Literal)
	at scala.tools.nsc.typechecker.Macros$MacroImplBinding$.unpickleAtom(Macros.scala:118)
	at scala.tools.nsc.typechecker.Macros$MacroImplBinding$$anonfun$7.apply(Macros.scala:186)
       [...]

Any clue?

@angleto
Copy link
Member Author

angleto commented Dec 6, 2017

@nyrk
I'm using the version 1.0.3 of sbt from linux ubuntu 17.04 Lts (tested also on 16.04 Lts). When you run sbt it creates (if does not exists) a "project" folder from the current working directory, maybe the content of a pre-existing "project" folder cause problem.
Did you try to run sbt dist from the orac-api folder?
Which sbt version are you using (sbt about)?

Below there is the content of sbt about on my computer:

[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /data/elegans.io/orac-api/project
[info] Loading settings from git.sbt,build.sbt ...
[info] Set current project to Orac API (in build file:/data/elegans.io/orac-api/)
[info] This is sbt 1.0.3
[info] The current project is {file:/data/elegans.io/orac-api/}orac-api b833a8c71a932cadf3dcc967e45430f3ca5eee3f-SNAPSHOT
[info] The current project is built against Scala 2.12.4
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.Giter8TemplatePlugin, com.typesafe.sbt.SbtNativePackager, com.typesafe.sbt.packager.archetypes.JavaAppPackaging, com.typesafe.sbt.packager.archetypes.JavaServerAppPackaging, com.typesafe.sbt.packager.archetypes.jar.ClasspathJarPlugin, com.typesafe.sbt.packager.archetypes.jar.LauncherJarPlugin, com.typesafe.sbt.packager.archetypes.scripts.AshScriptPlugin, com.typesafe.sbt.packager.archetypes.scripts.BashStartScriptPlugin, com.typesafe.sbt.packager.archetypes.scripts.BatStartScriptPlugin, com.typesafe.sbt.packager.archetypes.systemloader.SystemVPlugin, com.typesafe.sbt.packager.archetypes.systemloader.SystemdPlugin, com.typesafe.sbt.packager.archetypes.systemloader.SystemloaderPlugin, com.typesafe.sbt.packager.archetypes.systemloader.UpstartPlugin, com.typesafe.sbt.packager.debian.DebianDeployPlugin, com.typesafe.sbt.packager.debian.DebianPlugin, com.typesafe.sbt.packager.debian.JDebPackaging, com.typesafe.sbt.packager.docker.DockerPlugin, com.typesafe.sbt.packager.docker.DockerSpotifyClientPlugin, com.typesafe.sbt.packager.jdkpackager.JDKPackagerDeployPlugin, com.typesafe.sbt.packager.jdkpackager.JDKPackagerPlugin, com.typesafe.sbt.packager.linux.LinuxPlugin, com.typesafe.sbt.packager.rpm.RpmDeployPlugin, com.typesafe.sbt.packager.rpm.RpmPlugin, com.typesafe.sbt.packager.universal.UniversalDeployPlugin, com.typesafe.sbt.packager.universal.UniversalPlugin, com.typesafe.sbt.packager.windows.WindowsDeployPlugin, com.typesafe.sbt.packager.windows.WindowsPlugin, com.typesafe.sbt.MultiJvmPlugin, sbtassembly.AssemblyPlugin, com.typesafe.sbt.GitBranchPrompt, com.typesafe.sbt.GitPlugin, com.typesafe.sbt.GitVersioning, com.orrsella.sbtsublime.SublimePlugin, com.tapad.docker.DockerComposePlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.4

@nyrk
Copy link

nyrk commented Dec 6, 2017

I'm using sbt 1.0.3 on Fedora 26
I run sbt in a folder with a fresh and clean git clone of orac-api so there should not be present any pre-existing projext (I guess...)

sbt dist does not work (like any other sbt command):

> dist
[error] Not a valid command: dist (similar: set, iflast, last)
[error] dist
[error]     ^

sbt version is the following:

> about
[info] This is sbt 1.0.3
[info] No project is currently loaded
[info] sbt, sbt plugins, and build definitions are using Scala **2.10.4**

It seems that scala version does not match yours: could be this the root of the issue?

@angleto
Copy link
Member Author

angleto commented Dec 7, 2017

Yes the different version of scala could cause the problem. But sbt should download and use the version of scala specified into the build.sbt file.

This is the result of sbt from a new cloned orac-api folder

angelo@/data/elegans.io/temp/orac-api$ sbt
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /data/elegans.io/temp/orac-api/project
[info] Loading settings from git.sbt,build.sbt ...
[info] Set current project to Orac API (in build file:/data/elegans.io/temp/orac-api/)
[info] sbt server started at 127.0.0.1:4170
Orac API(master)>

Sbt gives the error "Not a valid command: dist ...." when the project does not contains a valid build.sbt file. The sbt command should be executed from the project base directory (same location of the build.sbt file).

@nyrk
Copy link

nyrk commented Dec 7, 2017

I have executed sbt in the root folder of a brand new git clone of orac-api source code (and, yes, in the folder there's the file build.sbt).
In fact, the first time I launched sbt, it downloaded a lot of stuff before going stuck in the scala.MatchError: false (of class scala.reflect.internal.Trees$Literal) error mentioned in my post.

The error on sbt dist, as far as I can understand, is due to the fact that, because of the scala.MatchError: false (of class scala.reflect.internal.Trees$Literal) error, sbt can't initialize a sesion and a project.

Whatever... I continue to investigate and I will try to install a more recent version of scala... even if, in theory, as you said, the correct version should be downloaded from sbt itself...

Stay tuna ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants