Commit 7945d0b1 authored by 35V LG84's avatar 35V LG84

build: split test to unit and integration targets

Split test target to test and it (integration test)
targets. Also remove BuildTime from buildinfo.

Update sbt-coverage to 1.6.0-RC1 and drop sbt-coveralls.
Signed-off-by: 35V LG84's avatar35V LG84 <35vlg84-x4e6b92@e257.fi>
parent e7054ab9
Pipeline #60833754 passed with stage
in 7 minutes and 14 seconds
......@@ -20,7 +20,7 @@ test·jdk11:
stage: "test"
script:
- sbt clean test
- sbt clean test it:test
test·jdk8:
......@@ -32,7 +32,7 @@ test·jdk8:
stage: "test"
script:
- sbt clean coverageOn test coverageReport
- sbt clean coverage test it:test
- sbt coverageAggregate
coverage: '/All done. Coverage was \[\d+.\d+%\]/'
......@@ -29,7 +29,8 @@ Updated deps and tools:
* Dependencies
** ...
* Build
** ...
** sbt-scoverage: 1.6.0-RC1
** sbt-coveralls: drop
* Tests
** ...
......
......@@ -109,6 +109,8 @@ lazy val apiJS = api.js
lazy val core = (project in file("core")).
dependsOn(apiJVM).
enablePlugins(Antlr4Plugin).
configs(IntegrationTest).
settings(Defaults.itSettings).
settings(commonSettings: _*).
settings(
name := "tackler-core",
......@@ -125,19 +127,23 @@ lazy val core = (project in file("core")).
libraryDependencies ++= circe_deps,
libraryDependencies += typesafeConfig,
libraryDependencies += jgit,
libraryDependencies += scalatest % "test",
libraryDependencies += scalatest % "it,test",
libraryDependencies ++= circe_deps_test,
)
lazy val cli = (project in file("cli")).
enablePlugins(BuildInfoPlugin).
dependsOn(core).
configs(IntegrationTest).
settings(Defaults.itSettings).
settings(noPublishSettings).
settings(commonSettings: _*).
settings(
fork := true,
Test / baseDirectory := file((Test / baseDirectory).value + "/.."),
Test / testOptions += {
IntegrationTest / baseDirectory := (Test / baseDirectory).value,
IntegrationTest / testOptions += {
// The evaluation of `streams` inside an anonymous function is prohibited.
// https://github.com/sbt/sbt/issues/3266
// https://github.com/jeffwilde/sbt-dynamodb/commit/109ea03837b1c1b4f45723c200d7aa5c34bb6e8b
......@@ -147,7 +153,10 @@ lazy val cli = (project in file("cli")).
assembly / test := {},
assemblyJarName in assembly := "tackler-cli" + "-" + version.value + ".jar",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoOptions += BuildInfoOption.BuildTime,
// Do not enable BuildInfoOption.BuildTime, it breaks coverage analysis of test + it:test
// targets because it causes recompilation, which in turn causes scoverage to clear instrumentation cache
// https://github.com/scoverage/sbt-scoverage/issues/277
// BuildInfo.BuildTime is also more hashle than what it is worth -> remove it altogether
buildInfoPackage := "fi.e257.tackler.cli",
buildInfoUsePackageAsPath := true,
buildInfoObject := "BuildInfo"
......@@ -158,7 +167,7 @@ lazy val cli = (project in file("cli")).
libraryDependencies += scallop,
libraryDependencies += typesafeConfig,
libraryDependencies += logback,
libraryDependencies += scalatest % "test",
libraryDependencies += dirsuite % "test"
libraryDependencies += scalatest % "it,test",
libraryDependencies += dirsuite % "it,test"
)
......@@ -234,7 +234,7 @@ object TacklerCli {
case org.rogach.scallop.exceptions.Version =>
// do not report success
Console.out.println("Version: " + BuildInfo.version + " [" + BuildInfo.builtAtString + "]")
Console.out.println("Version: " + BuildInfo.version)
FAILURE
case _: org.rogach.scallop.exceptions.ScallopException =>
......
......@@ -61,7 +61,7 @@ class TacklerCliArgs(args: Seq[String]) extends ScallopConf(args) {
ConfigFactory.parseMap(JavaConverters.mapAsJavaMap(optsAsMap))
}
version("Version: " + BuildInfo.version + " [" + BuildInfo.builtAtString + "]")
version("Version: " + BuildInfo.version)
/**
* Pure CLI-args (e.g. these don't have a setting in Config)
......
/*
* Copyright 2016-2018 E257.FI
* Copyright 2016-2019 E257.FI
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -22,10 +22,6 @@ class BuildInfoTest extends FlatSpec {
behavior of "BuildInfo"
it should "builtAtString" in {
assert(BuildInfo.builtAtString.startsWith("20"))
}
it should "scalaVersion" in {
assert(BuildInfo.scalaVersion.startsWith("2.12.8"))
}
......@@ -38,10 +34,6 @@ class BuildInfoTest extends FlatSpec {
assert(BuildInfo.sbtVersion.startsWith("1.2.8"))
}
it should "builtAtMillis" in {
assert(BuildInfo.builtAtMillis > 1547830076000L)
}
it should "toString" in {
assert(BuildInfo.toString.nonEmpty)
}
......
// test configuration: core/main
accounts {
strict = false
permit-empty-commodity = false
commodities = [ ]
coa = [
"a",
"a:b",
"e",
"e:b"
]
}
# this is used by SettingsTest
tackler {
core {
timezone = "Z"
basedir = this/is/tackler_conf/
auditing {
hash = "SHA-256"
txn-set-checksum = off
}
input {
storage = fs
fs {
dir = "tackler_conf_txns/"
glob = "**/tackler_conf_*.txn"
}
git {
repository = "test-tackler-data.git"
ref = "master"
dir = "txns"
suffix = ".txn"
}
}
reporting.scale.min = 2
reporting.scale.max = 7
reporting.reports = ["balance", "balance-group", "register"]
reporting.formats = ["txt"]
reporting.accounts = []
reporting.console = false
include "accounts.conf"
}
}
......@@ -12,29 +12,36 @@ link:https://gitlab.com/e257/accounting/tackler[GitLab / E257 / Accounting / Tac
== Building and testing
----
LC_ALL=C.UTF-8 sbt clean test
LC_ALL=C.UTF-8 sbt clean test it:test
----
=== Running tests
Some of the tests generate lots of output,
especially `cli/test` (and especially `fi.e257.tackler.cli.Dirsuite*` tests).
Some of the integration tests generate lots of output or take several minutes run.
Especially `cli/it:test` generates lots of output and `core/it:test` takes long time to run.
It might be helpful to run tests selectively, especially in case of errors:
Start `sbt` and run on sbt shell:
Start `LC_ALL=C.UTF-8 sbt` and run on sbt shell:
....
> apiJVM/test
> core/test
> cli/test
....
For cli tests you could run all at once (`cli/test`), or step-by-step. Last test target,
Dirsuite-tests will generate supstantial amount of output.
==== Running integration tests
You could run integration tests all at once (`core/it:test` and `cli/it:test`) or step-by-step.
cli intergration tests (Dirsuite-tests) will generate supstantial amount of output.
----
> cli/testOnly fi.e257.tackler.cli.BuildInfoTest
> cli/testOnly fi.e257.tackler.cli.TacklerCli*
> cli/testOnly fi.e257.tackler.cli.Dirsuite*
> core/it:test
> cli/it:test
# or select wanted Dirsuite
> cli/it:testOnly fi.e257.tackler.cli.Dirsuite...
----
......@@ -45,9 +52,9 @@ Dirsuite-tests will generate supstantial amount of output.
== Code coverage
sbt clean coveraOn test coverateReport
sbt coverageAggregate
----
LC_ALL=C.UTF-8 sbt clean coveraOn test coverageAggregate
----
== IntelliJ
......
......@@ -15,8 +15,8 @@ see xref:../../CONTRIBUTING.adoc[Contributor's Guide].
Documentation for external systems, see:
* xref:../server-api.adoc[Server API]
* xref:../client-api.adoc[Client API]
* link:https://tackler.e257.fi/docs/server-api/[Server API]
* link:https://tackler.e257.fi/docs/client-api/[Client API]
......
......@@ -48,7 +48,7 @@ object Dependencies {
val circe_deps_test = Seq(
"io.circe" %% "circe-optics"
).map(_ % circeOpticsVersion % "test")
).map(_ % circeOpticsVersion % "it,test")
val scalatest = "org.scalatest" %% "scalatest" % scalatestVersion
val scallop = "org.rogach" %% "scallop" % scallopVersion
......
......@@ -11,8 +11,7 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")
// QA tools
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.4")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0-RC1")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.1")
// Publishing
......
......@@ -50,7 +50,6 @@ Build-tools (used to build Tackler):
** link:https://github.com/sbt/sbt-assembly[sbt-assembly]
** link:https://github.com/xerial/sbt-sonatype[sbt-sonatype]
* QA
** link:https://github.com/scoverage/sbt-coveralls[sbt-coveralls]
** link:https://github.com/scoverage/sbt-scoverage[sbt-scoverage]
** link:https://github.com/wartremover/wartremover[WartRemover]
......
= Main TODO
== Build + tools
* Embedded proper GIT commit + dirty-state flag into build info
== Machinery
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment