From 716937b02871aa14be9e43e927b40456ecad17e3 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 29 May 2023 19:25:29 +0200 Subject: [PATCH] tests: Widely switch to new commit/branch syntax Lift most test cases to the new syntax, just with few exceptions: - tests/test_refspec/test2.yml actually stresses the mixed usage (but clean per repo) - tests/test_repo_includes references kas as external repo at a point where there was no new syntax yet; this needs to be migrated differently later on Signed-off-by: Jan Kiszka --- image-tests/isar/kas.yml | 6 +++--- image-tests/poky/kas.yml | 6 +++--- tests/test_commands.py | 12 ++++++------ tests/test_commands/test-invalid.yml | 4 ++-- tests/test_commands/test.yml | 6 +++--- tests/test_environment_variables/test_env.yml | 6 +++--- tests/test_layers/test.yml | 10 +++++----- tests/test_patch.py | 2 +- tests/test_patch/test-invalid.yml | 4 ++-- tests/test_patch/test-invalid2.yml | 4 ++-- tests/test_patch/test-invalid3.yml | 4 ++-- tests/test_patch/test.yml | 10 +++++----- tests/test_patch/test2.yml | 10 +++++----- tests/test_refspec/test.yml | 6 +++--- tests/test_refspec/test2.yml | 5 +++-- tests/test_refspec/test3.yml | 6 +++--- 16 files changed, 51 insertions(+), 50 deletions(-) diff --git a/image-tests/isar/kas.yml b/image-tests/isar/kas.yml index f728d7e..41ace23 100644 --- a/image-tests/isar/kas.yml +++ b/image-tests/isar/kas.yml @@ -1,7 +1,7 @@ # # kas - setup tool for bitbake based projects # -# Copyright (c) Siemens AG, 2022 +# Copyright (c) Siemens AG, 2022-2023 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -23,7 +23,7 @@ # header: - version: 11 + version: 14 build_system: isar @@ -35,7 +35,7 @@ target: mc:qemuamd64-bullseye:cowsay repos: isar: url: https://github.com/ilbers/isar.git - refspec: 8dfa97cf6e25a7adec2e02c50c5ef6329f31931b + commit: 8dfa97cf6e25a7adec2e02c50c5ef6329f31931b layers: meta: meta-isar: diff --git a/image-tests/poky/kas.yml b/image-tests/poky/kas.yml index 50ffa15..1fce47f 100644 --- a/image-tests/poky/kas.yml +++ b/image-tests/poky/kas.yml @@ -1,7 +1,7 @@ # # kas - setup tool for bitbake based projects # -# Copyright (c) Siemens AG, 2022 +# Copyright (c) Siemens AG, 2022-2023 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -23,14 +23,14 @@ # header: - version: 11 + version: 14 target: zlib-native repos: poky: url: https://git.yoctoproject.org/poky.git - refspec: 387ab5f18b17c3af3e9e30dc58584641a70f359f + commit: 387ab5f18b17c3af3e9e30dc58584641a70f359f layers: meta: meta-poky: diff --git a/tests/test_commands.py b/tests/test_commands.py index 9f76598..6a130ed 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -113,7 +113,7 @@ def test_dump(changedir, tmpdir, capsys): with open(outfile, 'r') as cf: flatconf = json.load(cf) if f == 'json' else yaml.safe_load(cf) - refspec = flatconf['repos']['kas3']['refspec'] + refspec = flatconf['repos']['kas3'].get('refspec', None) envvar = flatconf['env']['TESTVAR_FOO'] if r == '--resolve-refs': assert refspec != 'master' @@ -156,9 +156,9 @@ def test_lockfile(changedir, tmpdir, capsys): assert lockspec['overrides']['repos']['externalrepo']['commit'] \ == expected_commit - # insert older refspec into lockfile (kas 3.2 tag) - test_refspec = 'dc44638cd87c4d0045ea2ca441e682f3525d8b91' - lockspec['overrides']['repos']['externalrepo']['commit'] = test_refspec + # insert older commit into lockfile (kas 3.2 tag) + test_commit = 'dc44638cd87c4d0045ea2ca441e682f3525d8b91' + lockspec['overrides']['repos']['externalrepo']['commit'] = test_commit with open('test.lock.yml', 'w') as f: yaml.safe_dump(lockspec, f) @@ -166,11 +166,11 @@ def test_lockfile(changedir, tmpdir, capsys): kas.kas('dump test.yml'.split()) lockspec = yaml.safe_load(capsys.readouterr().out) assert lockspec['overrides']['repos']['externalrepo']['commit'] \ - == test_refspec + == test_commit # update lockfile, check if repo is pinned to other commit kas.kas('dump --lock --inplace --update test.yml'.split()) with open('test.lock.yml', 'r') as f: lockspec = yaml.safe_load(f) assert lockspec['overrides']['repos']['externalrepo']['commit'] \ - != test_refspec + != test_commit diff --git a/tests/test_commands/test-invalid.yml b/tests/test_commands/test-invalid.yml index 79004ab..872e0da 100644 --- a/tests/test_commands/test-invalid.yml +++ b/tests/test_commands/test-invalid.yml @@ -1,7 +1,7 @@ header: - version: 8 + version: 14 repos: kas_invalid: url: https://example.com/kas.git - refspec: this-ref-is-invalid + branch: this-ref-is-invalid diff --git a/tests/test_commands/test.yml b/tests/test_commands/test.yml index 382cc66..619cd52 100644 --- a/tests/test_commands/test.yml +++ b/tests/test_commands/test.yml @@ -1,13 +1,13 @@ header: - version: 8 + version: 14 repos: this: kas_1.0: url: https://github.com/siemens/kas.git - refspec: 907816a5c4094b59a36aec12226e71c461c05b77 + commit: 907816a5c4094b59a36aec12226e71c461c05b77 kas_1.1: url: https://github.com/siemens/kas.git - refspec: e9ca55a239caa1a2098e1d48773a29ea53c6cab2 + commit: e9ca55a239caa1a2098e1d48773a29ea53c6cab2 diff --git a/tests/test_environment_variables/test_env.yml b/tests/test_environment_variables/test_env.yml index 1cf50d7..750ffae 100644 --- a/tests/test_environment_variables/test_env.yml +++ b/tests/test_environment_variables/test_env.yml @@ -1,5 +1,5 @@ header: - version: 13 + version: 14 env: TESTVAR_DEFAULT_VAL: "BAR" @@ -13,13 +13,13 @@ repos: # Testing new BB_ENV_PASSTHROUGH_ADDITIONS bitbake_new: url: https://git.openembedded.org/bitbake - refspec: 87104b6a167188921da157c7dba45938849fb22a + commit: 87104b6a167188921da157c7dba45938849fb22a layers: .: excluded # Testing deprecated BB_ENV_WHITELIST bitbake_old: url: https://git.openembedded.org/bitbake - refspec: efaafc9ec2e8c0475e3fb27e877a1c0a5532a0e5 + commit: efaafc9ec2e8c0475e3fb27e877a1c0a5532a0e5 layers: .: excluded diff --git a/tests/test_layers/test.yml b/tests/test_layers/test.yml index c8ea3d6..285a1ea 100644 --- a/tests/test_layers/test.yml +++ b/tests/test_layers/test.yml @@ -1,29 +1,29 @@ header: - version: 8 + version: 14 repos: this: kas: url: https://github.com/siemens/kas.git - refspec: master + branch: master kas1: url: https://github.com/siemens/kas.git - refspec: master + branch: master layers: meta-foo: meta-bar: kas2: url: https://github.com/siemens/kas.git - refspec: master + branch: master layers: .: excluded kas3: url: https://github.com/siemens/kas.git - refspec: master + branch: master layers: .: meta-bar: diff --git a/tests/test_patch.py b/tests/test_patch.py index cfb5d89..a6e4709 100644 --- a/tests/test_patch.py +++ b/tests/test_patch.py @@ -42,7 +42,7 @@ def test_patch(changedir, tmpdir): def test_patch_update(changedir, tmpdir): """ - Test that patches are applied correctly after switching refspec from + Test that patches are applied correctly after switching a repo from a branch to a commit hash and vice-versa with both git and mercurial repositories. """ diff --git a/tests/test_patch/test-invalid.yml b/tests/test_patch/test-invalid.yml index 11d4d43..3bb3554 100644 --- a/tests/test_patch/test-invalid.yml +++ b/tests/test_patch/test-invalid.yml @@ -1,12 +1,12 @@ header: - version: 8 + version: 14 repos: this: kas: url: https://github.com/siemens/kas.git - refspec: 907816a5c4094b59a36aec12226e71c461c05b77 + commit: 907816a5c4094b59a36aec12226e71c461c05b77 patches: plain: repo: this diff --git a/tests/test_patch/test-invalid2.yml b/tests/test_patch/test-invalid2.yml index 95be172..08fd906 100644 --- a/tests/test_patch/test-invalid2.yml +++ b/tests/test_patch/test-invalid2.yml @@ -1,10 +1,10 @@ header: - version: 8 + version: 14 repos: kas: url: https://github.com/siemens/kas.git - refspec: 907816a5c4094b59a36aec12226e71c461c05b77 + commit: 907816a5c4094b59a36aec12226e71c461c05b77 patches: plain: repo: non-existent diff --git a/tests/test_patch/test-invalid3.yml b/tests/test_patch/test-invalid3.yml index 4c66a31..0617c96 100644 --- a/tests/test_patch/test-invalid3.yml +++ b/tests/test_patch/test-invalid3.yml @@ -1,12 +1,12 @@ header: - version: 8 + version: 14 repos: this: kas: url: https://github.com/ilbers/isar.git - refspec: 47aaeedecd0ea6f754da36be1d10717b04eb8275 + commit: 47aaeedecd0ea6f754da36be1d10717b04eb8275 patches: plain: repo: this diff --git a/tests/test_patch/test.yml b/tests/test_patch/test.yml index bba55af..4d4fd18 100644 --- a/tests/test_patch/test.yml +++ b/tests/test_patch/test.yml @@ -1,12 +1,12 @@ header: - version: 8 + version: 14 repos: this: kas: url: https://github.com/siemens/kas.git - refspec: 907816a5c4094b59a36aec12226e71c461c05b77 + commit: 907816a5c4094b59a36aec12226e71c461c05b77 patches: plain: repo: this @@ -17,7 +17,7 @@ repos: kas-branch: url: https://github.com/siemens/kas.git - refspec: master + branch: master patches: plain: repo: this @@ -25,7 +25,7 @@ repos: hello: url: https://www.mercurial-scm.org/repo/hello/ - refspec: 82e55d328c8c + commit: 82e55d328c8c type: hg patches: plain: @@ -37,7 +37,7 @@ repos: hello-branch: url: https://www.mercurial-scm.org/repo/hello/ - refspec: default + branch: default type: hg patches: plain: diff --git a/tests/test_patch/test2.yml b/tests/test_patch/test2.yml index bba27a6..48fa18e 100644 --- a/tests/test_patch/test2.yml +++ b/tests/test_patch/test2.yml @@ -1,12 +1,12 @@ header: - version: 8 + version: 14 repos: this: kas: url: https://github.com/siemens/kas.git - refspec: master + branch: master patches: plain: repo: this @@ -14,7 +14,7 @@ repos: kas-branch: url: https://github.com/siemens/kas.git - refspec: 907816a5c4094b59a36aec12226e71c461c05b77 + commit: 907816a5c4094b59a36aec12226e71c461c05b77 patches: plain: repo: this @@ -25,7 +25,7 @@ repos: hello: url: https://www.mercurial-scm.org/repo/hello/ - refspec: default + branch: default type: hg patches: plain: @@ -37,7 +37,7 @@ repos: hello-branch: url: https://www.mercurial-scm.org/repo/hello/ - refspec: 0a04b987be5a + commit: 0a04b987be5a type: hg patches: plain: diff --git a/tests/test_refspec/test.yml b/tests/test_refspec/test.yml index 7d4189f..c15d27d 100644 --- a/tests/test_refspec/test.yml +++ b/tests/test_refspec/test.yml @@ -1,13 +1,13 @@ header: - version: 8 + version: 14 repos: this: kas: url: https://github.com/siemens/kas.git - refspec: 907816a5c4094b59a36aec12226e71c461c05b77 + commit: 907816a5c4094b59a36aec12226e71c461c05b77 kas2: url: https://github.com/siemens/kas.git - refspec: master + branch: master diff --git a/tests/test_refspec/test2.yml b/tests/test_refspec/test2.yml index 5766e72..ae6fb4e 100644 --- a/tests/test_refspec/test2.yml +++ b/tests/test_refspec/test2.yml @@ -1,13 +1,14 @@ header: - version: 8 + version: 14 repos: this: kas: url: https://github.com/siemens/kas.git - refspec: master + branch: master kas2: url: https://github.com/siemens/kas.git + # keep legacy refspec here for testing purposes refspec: 907816a5c4094b59a36aec12226e71c461c05b77 diff --git a/tests/test_refspec/test3.yml b/tests/test_refspec/test3.yml index 2557cfe..41e3859 100644 --- a/tests/test_refspec/test3.yml +++ b/tests/test_refspec/test3.yml @@ -1,13 +1,13 @@ header: - version: 8 + version: 14 repos: this: kas_abs: url: https://github.com/siemens/kas.git - refspec: refs/heads/master + branch: refs/heads/master kas_rel: url: https://github.com/siemens/kas.git - refspec: master + branch: master