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

Migrate configure test to new IT infrastructure #1023

Merged
merged 4 commits into from
Jul 2, 2020

Conversation

hub-cap
Copy link
Contributor

@hub-cap hub-cap commented Jun 29, 2020

This commit moves the test_configure which validates the configure
command completes properly to the new infrastructure.

Relates #975

This commit moves the test_configure which validates the configure
command completes properly to the new infrastructure.

Relates elastic#975
@hub-cap hub-cap added enhancement Improves the status quo :misc Changes that don't affect users directly: linter fixes, test improvements, etc. labels Jun 29, 2020
@hub-cap hub-cap added this to the 2.0.1 milestone Jun 29, 2020
@hub-cap hub-cap requested a review from dliappis June 29, 2020 17:42
@hub-cap hub-cap self-assigned this Jun 29, 2020
Copy link
Contributor

@dliappis dliappis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for marching on with this task!

I left a few comments.

@it.rally_in_mem
def test_configure(cfg):
# just run to test the configuration procedure, don't use this configuration in other tests.
it.esrally_command_line_for(cfg, "configure --assume-defaults --configuration-name='config-integration-test'")
Copy link
Contributor

@dliappis dliappis Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at esrally_command_line_for():

return f"esrally {command_line} --kill-running-processes --configuration-name='{cfg}'"
:

Seems to be the above command will end up specifying --configuration-name= twice and additionally it doesn't test anything, just receiving a command line string.

I think what we want to do is validate that a new config works so we should assert the return value is 0.

Additionally we'll need to remove any test config.

I came up with the following working example:

$ git diff
diff --git a/it/__init__.py b/it/__init__.py
index 3ce0a7b..efc928f 100644
--- a/it/__init__.py
+++ b/it/__init__.py
@@ -198,8 +198,9 @@ def install_integration_test_config():
         copy_config(n)


-def remove_integration_test_config():
-    for n in CONFIG_NAMES:
+def remove_integration_test_config(config_names=None):
+    config_names = config_names or CONFIG_NAMES
+    for n in config_names:
         os.remove(ConfigFile(n).target_path)


diff --git a/it/configuration_test.py b/it/configuration_test.py
index 6a5f8f5..089ae4b 100644
--- a/it/configuration_test.py
+++ b/it/configuration_test.py
@@ -17,8 +17,16 @@

 import it

+CFG_FILE = "rally-config-integration-test"
+
+
+class TestConfigure:
+    def test_configure(self):
+        # just run to test the configuration procedure, don't use this configuration in other tests.
+        assert it.esrally(CFG_FILE, "configure --assume-defaults") == 0
+
+    @classmethod
+    def teardown_class(cls):
+        it.remove_integration_test_config([CFG_FILE])
+

-@it.rally_in_mem
-def test_configure(cfg):
-    # just run to test the configuration procedure, don't use this configuration in other tests.
-    it.esrally_command_line_for(cfg, "configure --assume-defaults --configuration-name='config-integration-test'")

@@ -250,12 +250,6 @@ function random_build_type {
eval "$1='${BUILD_TYPES[$((RANDOM%num_build_types))]}'"
}

function test_configure {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also remove the invocation of this function from

rally/integration-test.sh

Lines 418 to 419 in 12d7fc3

echo "**************************************** TESTING CONFIGURATION OF RALLY ****************************************"
test_configure
?

make it locally failed (but curious why it didn't fail in CI tests).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It failed for me as well. It is surely something environmental. I will look into it but I dont think that this commit has caused the instability.

Copy link
Contributor

@dliappis dliappis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

@hub-cap hub-cap merged commit 05bdd48 into elastic:master Jul 2, 2020
@hub-cap hub-cap deleted the migrate_test_configure branch July 2, 2020 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the status quo :misc Changes that don't affect users directly: linter fixes, test improvements, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants