From 0c7dd1865c4772731b826290b2f32e9d26603592 Mon Sep 17 00:00:00 2001 From: Ali Beyad Date: Mon, 12 Sep 2016 18:46:06 -0400 Subject: [PATCH] Reworking yaml tests for rolling upgrades --- .../org/elasticsearch/gradle/test/NodeInfo.groovy | 3 +++ qa/rolling-upgrade/build.gradle | 4 ++-- .../rest-api-spec/test/mixed_cluster/10_basic.yaml | 12 +++++++++--- .../test/upgraded_cluster/10_basic.yaml | 12 +++++++++--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy index 9a91c5ba138..85af2debf1b 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy @@ -206,6 +206,9 @@ class NodeInfo { /** Returns the data directory for this node */ File getDataDir() { + if (!(dataDir instanceof File)) { + return new File(dataDir) + } return dataDir } diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index acc59bb3bed..456db46d666 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -39,7 +39,7 @@ task mixedClusterTest(type: RestIntegTestTask) { distribution = 'zip' clusterName = 'rolling-upgrade' unicastTransportUri = { seedNode, node, ant -> oldClusterTest.nodes.get(0).transportUri() } - dataDir = "${-> oldClusterTest.nodes[1].dataDir}" + dataDir = "${-> oldClusterTest.nodes[1].getDataDir()}" } systemProperty 'tests.rest.suite', 'mixed_cluster' @@ -51,7 +51,7 @@ task upgradedClusterTest(type: RestIntegTestTask) { distribution = 'zip' clusterName = 'rolling-upgrade' unicastTransportUri = { seedNode, node, ant -> mixedClusterTest.nodes.get(0).transportUri() } - dataDir = "${-> oldClusterTest.nodes[0].dataDir}" + dataDir = "${-> oldClusterTest.nodes[0].getDataDir()}" } systemProperty 'tests.rest.suite', 'upgraded_cluster' } diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yaml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yaml index a46d7aaf044..dcfa946ed64 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yaml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/10_basic.yaml @@ -1,7 +1,13 @@ --- "Index data and search on the mixed cluster": - - do: - bulk: + - do: + search: + index: test_index + + - match: { hits.total: 5 } # no new indexed data, so expect the original 5 documents from the old cluster + + - do: + bulk: refresh: true body: - '{"index": {"_index": "test_index", "_type": "test_type"}}' @@ -19,4 +25,4 @@ search: index: test_index - - match: { hits.total: 10 } + - match: { hits.total: 10 } # 5 docs from old cluster, 5 docs from mixed cluster diff --git a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yaml b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yaml index edf9cb703d0..f6606c758a0 100644 --- a/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yaml +++ b/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/10_basic.yaml @@ -1,7 +1,13 @@ --- "Index data and search on the upgraded cluster": - - do: - bulk: + - do: + search: + index: test_index + + - match: { hits.total: 10 } # no new indexed data, so expect the original 10 documents from the old and mixed clusters + + - do: + bulk: refresh: true body: - '{"index": {"_index": "test_index", "_type": "test_type"}}' @@ -19,4 +25,4 @@ search: index: test_index - - match: { hits.total: 15 } + - match: { hits.total: 15 } # 10 docs from previous clusters plus 5 new docs