-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using dws-test-driver for DWS state progression integration tests
Signed-off-by: Nathan Lee <[email protected]>
- Loading branch information
1 parent
6296046
commit 593a298
Showing
21 changed files
with
549 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,6 @@ | |
path = testsuite/submodules/slurm-docker-cluster | ||
url = [email protected]:DataWorkflowServices/slurm-docker-cluster.git | ||
branch = master | ||
[submodule "testsuite/submodules/dws-test-driver"] | ||
path = testsuite/submodules/dws-test-driver | ||
url = [email protected]:DataWorkflowServices/dws-test-driver.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ pytest == 7 | |
pytest-bdd == 6 | ||
pytest-html == 3 | ||
docker == 6 | ||
kubernetes >= 25.3 | ||
kubernetes >= 25.3 | ||
tenacity == 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Copyright 2022 Hewlett Packard Enterprise Development LP | ||
# Other additional copyright holders may be indicated within. | ||
# | ||
# The entirety of this work is licensed under the Apache License, | ||
# Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
#SBATCH --output=/jobs/slurm-%j.out | ||
#DW Proposal action=complete | ||
#DW DataIn action=wait | ||
/bin/hostname | ||
srun -l /bin/hostname | ||
srun -l /bin/pwd |
117 changes: 117 additions & 0 deletions
117
testsuite/integration/src/features/test_dws_states.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# | ||
# Copyright 2022 Hewlett Packard Enterprise Development LP | ||
# Other additional copyright holders may be indicated within. | ||
# | ||
# The entirety of this work is licensed under the Apache License, | ||
# Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
Feature: Data Workflow Services State Progression | ||
Verify that the DWS-Slurm Burst Buffer Plugin progresses through Data | ||
Workflow Services states | ||
|
||
Scenario: The DWS-BB Plugin progresses through DWS states | ||
Given a job script: | ||
#!/bin/bash | ||
|
||
#DW Proposal action=wait | ||
#DW Setup action=wait | ||
#DW DataIn action=wait | ||
#DW PreRun action=wait | ||
#DW PostRun action=wait | ||
#DW DataOut action=wait | ||
#DW Teardown action=wait | ||
/bin/hostname | ||
|
||
When the job is run | ||
And a Workflow is created for the job | ||
#Then the job's temporary Workflow is not found | ||
Then the Workflow and job progress to the Proposal state | ||
And the Workflow and job progress to the Setup state | ||
And the Workflow and job progress to the DataIn state | ||
And the Workflow and job progress to the PreRun state | ||
And the Workflow and job progress to the PostRun state | ||
And the Workflow and job progress to the DataOut state | ||
And the Workflow and job progress to the Teardown state | ||
And the job completes successfully | ||
|
||
@todo | ||
Scenario: The DWS-BB Plugin can handle DWS driver errors | ||
Given a job script: | ||
#!/bin/bash | ||
|
||
#DW <state> action=error message=TEST_ERROR | ||
#DW Teardown action=wait | ||
/bin/hostname | ||
|
||
When the job is run | ||
And a Workflow is created for the job | ||
Then the Workflow and job progress to the Teardown state | ||
And the job shows an error with message "TEST ERROR" | ||
|
||
Examples: | ||
# *** HEADER *** | ||
| state | | ||
# *** VALUES *** | ||
| Proposal | | ||
| Setup | | ||
| DataIn | | ||
| PreRun | | ||
| PostRun | | ||
| DataOut | | ||
|
||
@todo | ||
Scenario: The DWS-BB Plugin can handle a DWS driver error during Teardown | ||
Given a job script: | ||
#!/bin/bash | ||
|
||
#DW Teardown action=error message=TEST_ERROR | ||
/bin/hostname | ||
|
||
When the job is run | ||
And a Workflow is created for the job | ||
Then the job shows an error with message "TEST ERROR" | ||
|
||
@todo | ||
Scenario: The DWS-BB Plugin can cancel jobs | ||
Given a job script: | ||
#!/bin/bash | ||
|
||
#DW <state> action=wait | ||
#DW Teardown action=wait | ||
/bin/hostname | ||
|
||
When the job is run | ||
And a Workflow is created for the job | ||
And the Workflow and job progress to the <state> state | ||
And the job is canceled with the hurry flag set to <hurry_flag> | ||
Then the Workflow and job progress to the Teardown state | ||
And the Workflow's hurry flag is set to <hurry_flag> | ||
|
||
Examples: | ||
# *** HEADER *** | ||
| state | hurry_flag | | ||
# *** VALUES *** | ||
| Proposal | false | | ||
| Setup | false | | ||
| DataIn | false | | ||
| PreRun | false | | ||
| PostRun | false | | ||
| DataOut | false | | ||
| Proposal | true | | ||
| Setup | true | | ||
| DataIn | true | | ||
| PreRun | true | | ||
| PostRun | true | | ||
| DataOut | true | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# | ||
# Copyright 2022 Hewlett Packard Enterprise Development LP | ||
# Other additional copyright holders may be indicated within. | ||
# | ||
# The entirety of this work is licensed under the Apache License, | ||
# Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import os | ||
import pytest | ||
import secrets | ||
|
||
from .slurmctld import Slurmctld | ||
from kubernetes import client, config | ||
from pytest_bdd import ( | ||
given, | ||
scenarios, | ||
parsers, | ||
then, | ||
when, | ||
) | ||
|
||
@pytest.fixture | ||
def k8s(): | ||
config.load_kube_config() | ||
return client | ||
|
||
@pytest.fixture | ||
def slurmctld(): | ||
return Slurmctld() | ||
|
||
def pytest_bdd_apply_tag(tag, function): | ||
if tag == 'todo': | ||
marker = pytest.mark.skip(reason="Not implemented yet") | ||
marker(function) | ||
return True | ||
else: | ||
# Fall back to the default behavior of pytest-bdd | ||
return None | ||
|
||
@given(parsers.parse('a job script:\n{script}'), target_fixture="script_path") | ||
def _(script): | ||
"""a simple job script: <script>""" | ||
path = "/jobs/" + secrets.token_hex(5) + "-job.sh" | ||
with open(path, "w") as file: | ||
file.write(script) | ||
|
||
yield path | ||
|
||
os.remove(path) | ||
|
||
@when('the job is run', target_fixture="jobId") | ||
def _(slurmctld, script_path): | ||
"""the job is run.""" | ||
jobId,outputFilePath = slurmctld.submit_job(script_path) | ||
print("submitted job: " + str(jobId)) | ||
|
||
yield jobId | ||
|
||
# remove the slurm output from the jobs folder | ||
slurmctld.remove_job_output(outputFilePath) | ||
|
||
@then('the job completes successfully') | ||
def _(slurmctld, jobId): | ||
"""the job completes successfully.""" | ||
state = slurmctld.get_final_job_state(jobId) | ||
assert state=="COMPLETED", "Unexpected Job State: " + state | ||
|
Empty file.
Oops, something went wrong.