Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions test/functional/job_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,23 @@ def __init__(self, config, expected_to_fail, expected_num_subjobs, expected_num_

# This is a very basic job where each atom just creates a simple text file.
BASIC_JOB = FunctionalTestJobConfig(
config="""

config={
'posix': """
BasicJob:
commands:
- echo $TOKEN > $ARTIFACT_DIR/result.txt
atomizers:
- TOKEN: seq 0 4 | xargs -I {} echo "This is atom {}"

""",
'nt': """
BasicJob:
commands:
- echo !TOKEN!> !ARTIFACT_DIR!\\result.txt
atomizers:
- TOKEN: FOR /l %n in (0,1,4) DO @echo This is atom %n
""",
},
expected_to_fail=False,
expected_num_subjobs=5,
expected_num_atoms=5,
Expand All @@ -48,8 +56,8 @@ def __init__(self, config, expected_to_fail, expected_num_subjobs, expected_num_

# This is a very basic job, but one of the atoms will fail with non-zero exit code.
BASIC_FAILING_JOB = FunctionalTestJobConfig(
config="""

config={
'posix': """
BasicFailingJob:
commands:
- if [ "$TOKEN" = "This is atom 3" ]; then exit 1; fi
Expand All @@ -58,6 +66,14 @@ def __init__(self, config, expected_to_fail, expected_num_subjobs, expected_num_
- TOKEN: seq 0 4 | xargs -I {} echo "This is atom {}"

""",
'nt': """
BasicFailingJob:
commands:
- IF "!TOKEN!" == "This is atom 3" (EXIT 1) ELSE (echo !TOKEN!> !ARTIFACT_DIR!\\result.txt)
atomizers:
- TOKEN: FOR /l %n in (0,1,4) DO @echo This is atom %n
""",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this config empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR is more about the 'how' to have platform specific commands in functional test configs than 'what' exactly those commands would be. I am rewriting those shell commands in batch, but it's gonna take a little while. This is also good for keep each PR small. What you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@josephharrington I have one last job config to rewrite anyway. I will update the PR with all batch commands under key 'nt'.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good. That's what I figured but I wanted to make sure.

},
expected_to_fail=True,
expected_num_subjobs=5,
expected_num_atoms=5,
Expand All @@ -76,7 +92,8 @@ def __init__(self, config, expected_to_fail, expected_num_subjobs, expected_num_
# This is a more complex job. Each step (setup_build, commands, teardown_build) depends on the previous steps. This
# config also includes short sleeps to help tease out race conditions around setup and teardown timing.
JOB_WITH_SETUP_AND_TEARDOWN = FunctionalTestJobConfig(
config="""
config={
'posix': """

JobWithSetupAndTeardown:
setup_build:
Expand All @@ -101,6 +118,9 @@ def __init__(self, config, expected_to_fail, expected_num_subjobs, expected_num_
- echo "teardown." | tee -a $ALL_SUBJOB_FILES

""",
'nt': """
""",
},
expected_to_fail=False,
expected_num_subjobs=3,
expected_num_atoms=3,
Expand Down
4 changes: 3 additions & 1 deletion test/functional/master/test_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from test.framework.functional.base_functional_test_case import BaseFunctionalTestCase
from test.functional.job_configs import BASIC_JOB

Expand All @@ -9,7 +11,7 @@ def _start_master_only_and_post_a_new_job(self):

build_resp = master.post_new_build({
'type': 'directory',
'config': BASIC_JOB.config,
'config': BASIC_JOB.config[os.name],
'project_directory': '/tmp',
})
build_id = build_resp['build_id']
Expand Down
4 changes: 3 additions & 1 deletion test/functional/master/test_shutdown.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import tempfile

from test.framework.functional.base_functional_test_case import BaseFunctionalTestCase
from test.functional.job_configs import JOB_WITH_SETUP_AND_TEARDOWN

Expand Down Expand Up @@ -44,7 +46,7 @@ def test_shutdown_all_slaves_while_build_is_running_should_finish_build_then_kil
project_dir = tempfile.TemporaryDirectory()
build_resp = master.post_new_build({
'type': 'directory',
'config': JOB_WITH_SETUP_AND_TEARDOWN.config,
'config': JOB_WITH_SETUP_AND_TEARDOWN.config[os.name],
'project_directory': project_dir.name,
})
build_id = build_resp['build_id']
Expand Down
6 changes: 4 additions & 2 deletions test/functional/test_cluster_basic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from genty import genty, genty_dataset
import os
import tempfile
from unittest import skip

from genty import genty, genty_dataset

from test.framework.functional.base_functional_test_case import BaseFunctionalTestCase
from test.framework.functional.fs_item import Directory, File
from test.functional.job_configs import BASIC_FAILING_JOB, BASIC_JOB, JOB_WITH_SETUP_AND_TEARDOWN
Expand All @@ -22,7 +24,7 @@ def test_basic_directory_configs_end_to_end(self, test_job_config):
project_dir = tempfile.TemporaryDirectory()
build_resp = master.post_new_build({
'type': 'directory',
'config': test_job_config.config,
'config': test_job_config.config[os.name],
'project_directory': project_dir.name,
})
build_id = build_resp['build_id']
Expand Down