Skip to content

Commit

Permalink
Merge pull request #11127 from SaschaPeukert/3.4-fix-and-enable-accep…
Browse files Browse the repository at this point in the history
…tance-and-tck-tests

Make (almost all) TCKTests and AcceptanceTests executable with maven
  • Loading branch information
fickludd committed Mar 1, 2018
2 parents 951bebd + b249103 commit 9a3c928
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 6 deletions.
21 changes: 21 additions & 0 deletions enterprise/cypher/acceptance-spec-suite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,27 @@
<artifactId>scalacheck_2.11</artifactId>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-plattform-runner.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<!-- neo4j -->

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ Feature: IndexAcceptance
RETURN p
"""
Then the result should be:
| p |
| p |
And no side effects

Scenario: Index seek should handle null value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ package cypher.features

import java.io.File
import java.net.URI
import java.util.Collection
import java.util

import cypher.features.ScenarioTestHelper._
import org.junit.jupiter.api.Assertions.fail
import org.junit.jupiter.api.{DynamicTest, Test, TestFactory}
import org.junit.jupiter.api.{DynamicTest, TestFactory}
import org.junit.platform.runner.JUnitPlatform
import org.junit.runner.RunWith
import org.opencypher.tools.tck.api.{CypherTCK, Scenario}

@RunWith(classOf[JUnitPlatform])
class AcceptanceTests extends BaseFeatureTest {

// these two should be empty on commit!
Expand All @@ -41,4 +43,14 @@ class AcceptanceTests extends BaseFeatureTest {
val all = CypherTCK.parseFilesystemFeatures(new File(featuresURI)).flatMap(_.scenarios)
filterScenarios(all)
}

@TestFactory
override def runCompatibility23(): util.Collection[DynamicTest] = {
//TODO: Investigate flakiness, it should not work in 2.3
def isFlakyOn23(scenario: Scenario): Boolean = {
scenario.name.equals("STARTS WITH should handle null prefix") && scenario.featureName.equals("IndexAcceptance")
}

createTests(scenarios.filterNot(isFlakyOn23), Compatibility23TestConfig)
}
}
21 changes: 21 additions & 0 deletions enterprise/cypher/compatibility-spec-suite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,27 @@
<artifactId>scalap</artifactId>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-plattform-runner.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<!-- neo4j -->

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ Feature "MatchAcceptance": Scenario "Return relationships by fetching them from
Feature "MatchAcceptance": Scenario "Return relationships by collecting them as a list - wrong way"
Feature "MatchAcceptance": Scenario "Return relationships by collecting them as a list - undirected"
Feature "MatchAcceptance": Scenario "Return relationships by collecting them as a list"
Feature "MatchAcceptance": Scenario "Return relationships by collecting them as a list - directed, one way"
Feature "MatchAcceptance": Scenario "Return relationships by collecting them as a list - undirected, starting from two extremes"
Feature "MatchAcceptance": Scenario "Return relationships by collecting them as a list - undirected, starting from one extreme"
Feature "MatchAcceptance": Scenario "Return a var length path"
Feature "MatchAcceptance": Scenario "Return a var length path of length zero"
Feature "MatchAcceptance": Scenario "Return a named var length path of length zero"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,30 @@ package cypher.features

import java.nio.file.FileSystems

import org.junit.platform.runner.JUnitPlatform
import org.junit.runner.RunWith
import org.junit.jupiter.api.AfterEach
import org.opencypher.tools.tck.api.{CypherTCK, Scenario}

@RunWith(classOf[JUnitPlatform])
class TCKTests extends BaseFeatureTest {

// these two should be empty on commit!
override val featureToRun = ""
override val scenarioToRun = ""

override val scenarios: Seq[Scenario] = {
val allScenarios: Seq[Scenario] = CypherTCK.allTckScenarios
val allScenarios: Seq[Scenario] = CypherTCK.allTckScenarios.filterNot(testsWithEncodingProblems)
filterScenarios(allScenarios)
}

// those tests run into some utf-8 encoding problems on some of our machines at the moment - fix for that is on the way on TCK side
// TODO: Remove this filter when new version of TCK (1.0.0-M10) is released
def testsWithEncodingProblems(scenario: Scenario): Boolean = {
(scenario.name.equals("Fail for invalid Unicode hyphen in subtraction") && scenario.featureName.equals("SemanticErrorAcceptance")) ||
(scenario.name.equals("Accept valid Unicode literal") && scenario.featureName.equals("ReturnAcceptance2"))
}

@AfterEach
def tearDown(): Unit = {
//TODO: This method can be removed with new release of TCK (1.0.0-M10)
Expand Down
2 changes: 2 additions & 0 deletions enterprise/cypher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<licensing.prepend.text>notice-agpl-prefix.txt</licensing.prepend.text>
<license-text.header>AGPL-3-header.txt</license-text.header>
<opencypher.version>1.0.0-M09</opencypher.version>
<junit-plattform-runner.version>1.1.0</junit-plattform-runner.version>
<junit-jupiter.version>5.1.0</junit-jupiter.version>
</properties>

<scm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object ScenarioTestHelper {
scenario(Neo4jAdapter(config.executionPrefix)).execute()
} match {
case Success(_) => throw new IllegalStateException("Unexpectedly succeeded in the following blacklisted scenario:\n" + name)
case Failure(e) => println("Failed as expected with\n " + e.getMessage)
case Failure(e) => // failed as expected
}
}
}
Expand Down

0 comments on commit 9a3c928

Please sign in to comment.