diff --git a/tests/loader/fixtures/deprecated-include-raw-escaped001.json b/tests/loader/fixtures/deprecated-include-raw-escaped001.json index 47b253279..8ec298fde 100644 --- a/tests/loader/fixtures/deprecated-include-raw-escaped001.json +++ b/tests/loader/fixtures/deprecated-include-raw-escaped001.json @@ -1,6 +1,5 @@ [ { - "name": "test-job-include-raw-1", "builders": [ { "shell": "#!/bin/bash\n#\n# Sample script showing how the yaml include-raw tag can be used\n# to inline scripts that are maintained outside of the jenkins\n# job yaml configuration.\n\necho \"hello world\"\n\nexit 0\n" @@ -9,6 +8,7 @@ "shell": "#!/bin/bash\n#\n# sample script to check that brackets aren't escaped\n# when using the include-raw application yaml tag\n\nVAR1=\"hello\"\nVAR2=\"world\"\nVAR3=\"${VAR1} ${VAR2}\"\n\n[[ -n \"${VAR3}\" ]] && {\n # this next section is executed as one\n echo \"${VAR3}\"\n exit 0\n}\n" } ], - "description": "" + "description": "", + "name": "test-job-include-raw-1" } ] diff --git a/tests/loader/fixtures/deprecated-include-raw001.json b/tests/loader/fixtures/deprecated-include-raw001.json index 47b253279..8ec298fde 100644 --- a/tests/loader/fixtures/deprecated-include-raw001.json +++ b/tests/loader/fixtures/deprecated-include-raw001.json @@ -1,6 +1,5 @@ [ { - "name": "test-job-include-raw-1", "builders": [ { "shell": "#!/bin/bash\n#\n# Sample script showing how the yaml include-raw tag can be used\n# to inline scripts that are maintained outside of the jenkins\n# job yaml configuration.\n\necho \"hello world\"\n\nexit 0\n" @@ -9,6 +8,7 @@ "shell": "#!/bin/bash\n#\n# sample script to check that brackets aren't escaped\n# when using the include-raw application yaml tag\n\nVAR1=\"hello\"\nVAR2=\"world\"\nVAR3=\"${VAR1} ${VAR2}\"\n\n[[ -n \"${VAR3}\" ]] && {\n # this next section is executed as one\n echo \"${VAR3}\"\n exit 0\n}\n" } ], - "description": "" + "description": "", + "name": "test-job-include-raw-1" } ] diff --git a/tests/loader/fixtures/deprecated-include001.json b/tests/loader/fixtures/deprecated-include001.json index 3da58e53b..1cfc92b55 100644 --- a/tests/loader/fixtures/deprecated-include001.json +++ b/tests/loader/fixtures/deprecated-include001.json @@ -1,6 +1,5 @@ [ { - "name": "test-job-1", "builders": [ { "copyartifact": { @@ -40,6 +39,7 @@ } } ], - "description": "" + "description": "", + "name": "test-job-1" } ] diff --git a/tests/loader/fixtures/include-raw-escaped-multi001.json b/tests/loader/fixtures/include-raw-escaped-multi001.json index eb6dc0d93..b6ba734e7 100644 --- a/tests/loader/fixtures/include-raw-escaped-multi001.json +++ b/tests/loader/fixtures/include-raw-escaped-multi001.json @@ -1,11 +1,11 @@ [ { - "name": "test-job-include-raw-1", "builders": [ { "shell": "#!/bin/bash\n#\n# Sample script showing how the yaml include-raw tag can be used\n# to inline scripts that are maintained outside of the jenkins\n# job yaml configuration.\n\necho \"hello world\"\n\nexit 0\n\n#!/bin/bash\n#\n# sample script to check that brackets aren't escaped\n# when using the include-raw application yaml tag\n\nVAR1=\"hello\"\nVAR2=\"world\"\nVAR3=\"${VAR1} ${VAR2}\"\n\n[[ -n \"${VAR3}\" ]] && {\n # this next section is executed as one\n echo \"${VAR3}\"\n exit 0\n}\n" } ], - "description": "" + "description": "", + "name": "test-job-include-raw-1" } ] diff --git a/tests/loader/fixtures/include-raw-escaped001-job.json b/tests/loader/fixtures/include-raw-escaped001-job.json index a5f29b4b6..21af3e732 100644 --- a/tests/loader/fixtures/include-raw-escaped001-job.json +++ b/tests/loader/fixtures/include-raw-escaped001-job.json @@ -1,6 +1,5 @@ [ { - "name": "test-job-include-raw", "builders": [ { "shell": "#!/bin/bash\n#\n# Sample script showing how the yaml include-raw tag can be used\n# to inline scripts that are maintained outside of the jenkins\n# job yaml configuration.\n\necho \"hello world\"\n\nexit 0\n" @@ -9,6 +8,7 @@ "shell": "#!/bin/bash\n#\n# sample script to check that brackets aren't escaped\n# when using the include-raw application yaml tag\n\nVAR1=\"hello\"\nVAR2=\"world\"\nVAR3=\"${{VAR1}} ${{VAR2}}\"\n\n[[ -n \"${{VAR3}}\" ]] && {{\n # this next section is executed as one\n echo \"${{VAR3}}\"\n exit 0\n}}\n" } ], - "description": "" + "description": "", + "name": "test-job-include-raw" } ] diff --git a/tests/loader/fixtures/include-raw-escaped001-template.json b/tests/loader/fixtures/include-raw-escaped001-template.json index 47b253279..8ec298fde 100644 --- a/tests/loader/fixtures/include-raw-escaped001-template.json +++ b/tests/loader/fixtures/include-raw-escaped001-template.json @@ -1,6 +1,5 @@ [ { - "name": "test-job-include-raw-1", "builders": [ { "shell": "#!/bin/bash\n#\n# Sample script showing how the yaml include-raw tag can be used\n# to inline scripts that are maintained outside of the jenkins\n# job yaml configuration.\n\necho \"hello world\"\n\nexit 0\n" @@ -9,6 +8,7 @@ "shell": "#!/bin/bash\n#\n# sample script to check that brackets aren't escaped\n# when using the include-raw application yaml tag\n\nVAR1=\"hello\"\nVAR2=\"world\"\nVAR3=\"${VAR1} ${VAR2}\"\n\n[[ -n \"${VAR3}\" ]] && {\n # this next section is executed as one\n echo \"${VAR3}\"\n exit 0\n}\n" } ], - "description": "" + "description": "", + "name": "test-job-include-raw-1" } ] diff --git a/tests/loader/fixtures/include-raw-multi001.json b/tests/loader/fixtures/include-raw-multi001.json index eb6dc0d93..b6ba734e7 100644 --- a/tests/loader/fixtures/include-raw-multi001.json +++ b/tests/loader/fixtures/include-raw-multi001.json @@ -1,11 +1,11 @@ [ { - "name": "test-job-include-raw-1", "builders": [ { "shell": "#!/bin/bash\n#\n# Sample script showing how the yaml include-raw tag can be used\n# to inline scripts that are maintained outside of the jenkins\n# job yaml configuration.\n\necho \"hello world\"\n\nexit 0\n\n#!/bin/bash\n#\n# sample script to check that brackets aren't escaped\n# when using the include-raw application yaml tag\n\nVAR1=\"hello\"\nVAR2=\"world\"\nVAR3=\"${VAR1} ${VAR2}\"\n\n[[ -n \"${VAR3}\" ]] && {\n # this next section is executed as one\n echo \"${VAR3}\"\n exit 0\n}\n" } ], - "description": "" + "description": "", + "name": "test-job-include-raw-1" } ] diff --git a/tests/loader/fixtures/include-raw001-job.json b/tests/loader/fixtures/include-raw001-job.json index 47b253279..8ec298fde 100644 --- a/tests/loader/fixtures/include-raw001-job.json +++ b/tests/loader/fixtures/include-raw001-job.json @@ -1,6 +1,5 @@ [ { - "name": "test-job-include-raw-1", "builders": [ { "shell": "#!/bin/bash\n#\n# Sample script showing how the yaml include-raw tag can be used\n# to inline scripts that are maintained outside of the jenkins\n# job yaml configuration.\n\necho \"hello world\"\n\nexit 0\n" @@ -9,6 +8,7 @@ "shell": "#!/bin/bash\n#\n# sample script to check that brackets aren't escaped\n# when using the include-raw application yaml tag\n\nVAR1=\"hello\"\nVAR2=\"world\"\nVAR3=\"${VAR1} ${VAR2}\"\n\n[[ -n \"${VAR3}\" ]] && {\n # this next section is executed as one\n echo \"${VAR3}\"\n exit 0\n}\n" } ], - "description": "" + "description": "", + "name": "test-job-include-raw-1" } ] diff --git a/tests/loader/fixtures/include-raw001-template.json b/tests/loader/fixtures/include-raw001-template.json index 679c8f64c..d96b182b8 100644 --- a/tests/loader/fixtures/include-raw001-template.json +++ b/tests/loader/fixtures/include-raw001-template.json @@ -1,11 +1,11 @@ [ { - "name": "test-job-include-raw-1", "builders": [ { "shell": "#!/bin/bash\n#\n# sample script to check that brackets aren't escaped\n# when using the include-raw application yaml tag\n\nVAR1=\"1\"\nVAR2=\"world\"\nVAR3=\"${VAR1} ${VAR2}\"\n\n[[ -n \"${VAR3}\" ]] && {\n # this next section is executed as one\n echo \"${VAR3}\"\n exit 0\n}\n" } ], - "description": "" + "description": "", + "name": "test-job-include-raw-1" } ] diff --git a/tests/loader/fixtures/include001.json b/tests/loader/fixtures/include001.json index 3da58e53b..1cfc92b55 100644 --- a/tests/loader/fixtures/include001.json +++ b/tests/loader/fixtures/include001.json @@ -1,6 +1,5 @@ [ { - "name": "test-job-1", "builders": [ { "copyartifact": { @@ -40,6 +39,7 @@ } } ], - "description": "" + "description": "", + "name": "test-job-1" } ] diff --git a/tests/loader/fixtures/joinlists.json b/tests/loader/fixtures/joinlists.json index 80504a3fe..d69a30bfc 100644 --- a/tests/loader/fixtures/joinlists.json +++ b/tests/loader/fixtures/joinlists.json @@ -1,6 +1,5 @@ [ { - "name": "sample-job", "builders": [ { "shell": [ @@ -13,6 +12,7 @@ ] } ], - "description": "" + "description": "", + "name": "sample-job" } ] diff --git a/tests/loader/test_loader.py b/tests/loader/test_loader.py index 33b1ea018..cb35fc202 100644 --- a/tests/loader/test_loader.py +++ b/tests/loader/test_loader.py @@ -62,7 +62,7 @@ def test_include(scenario, jjb_config, expected_output): roots = Roots(jjb_config) load_files(jjb_config, roots, [scenario.in_path]) - job_data_list = [j.data for j in roots.generate_jobs()] + job_data_list = [dict(sorted(j.data.items())) for j in roots.generate_jobs()] pretty_json = json.dumps(job_data_list, indent=4) print(pretty_json) assert pretty_json == expected_output.strip()