Skip to content

Commit

Permalink
Merge pull request #1529 from dmach/1.6.x-backports
Browse files Browse the repository at this point in the history
Backport several bugfixes from master to 1.6.x-maint branch
  • Loading branch information
dmach authored Apr 15, 2024
2 parents 2616ca4 + 1d0d950 commit 493f786
Show file tree
Hide file tree
Showing 21 changed files with 389 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'build and installation tests'

on:
pull_request:
branches: ['master']
branches: ['master', '1.6.x-maint']
paths-ignore:
- 'AUTHORS'
- 'COPYING'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: "CodeQL"

on:
push:
branches: [ "master" ]
branches: [ "master", "1.6.x-maint" ]
pull_request:
branches: [ "master" ]
branches: [ "master", "1.6.x-maint" ]
schedule:
- cron: "13 12 * * 6"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'linters'

on:
pull_request:
branches: ['master']
branches: ['master', '1.6.x-maint']
paths:
- '.github/**'
- '**.py'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'tests'

on:
pull_request:
branches: ['master']
branches: ['master', '1.6.x-maint']
paths:
- '.github/**'
- '**.py'
Expand Down Expand Up @@ -103,8 +103,9 @@ jobs:
steps:
- name: "Install packages"
run: |
sudo sh -c '. /etc/os-release; echo "deb [trusted=yes] http://download.opensuse.org/repositories/openSUSE:Tools/xUbuntu_${VERSION_ID} ./" > /etc/apt/sources.list.d/openSUSE-Tools.list'
sudo apt-get -y update
sudo apt-get -y --no-install-recommends install python3-behave diffstat diffutils python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3
sudo apt-get -y --no-install-recommends install python3-behave diffstat diffutils python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3 obs-build obs-service-set-version
- name: "Checkout sources"
uses: actions/checkout@v3
Expand Down
6 changes: 6 additions & 0 deletions behave/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ $ podman stop|kill obs-server
$ podman rmi obs-server
```

Install test dependencies
-------------------------
```
$ zypper install python3-behave diffstat diffutils obs-service-replace_using_env python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3 build obs-service-set_version
```

Run tests
---------

Expand Down
26 changes: 26 additions & 0 deletions behave/container-setup-initial-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ OSC="osc -A https://localhost"
# create projects
$OSC api -X PUT '/source/openSUSE.org/_meta' --file "$FIXTURES_DIR/prj/openSUSE.org.xml"
$OSC api -X PUT '/source/test:devel/_meta' --file "$FIXTURES_DIR/prj/test_devel.xml"

# test:factory:update inherits from test:factory; test:factory has test:devel devel project
$OSC api -X PUT '/source/test:factory/_meta' --file "$FIXTURES_DIR/prj/test_factory.xml"
$OSC api -X PUT '/source/test:factory:update/_meta' --file "$FIXTURES_DIR/prj/test_factory_update.xml"

# test:leap:15.6:update inherits from test:leap:15.6; test:leap:15.6 has no devel project
$OSC api -X PUT '/source/test:leap:15.6/_meta' --file "$FIXTURES_DIR/prj/test_leap_15.6.xml"
$OSC api -X PUT '/source/test:leap:15.6:update/_meta' --file "$FIXTURES_DIR/prj/test_leap_15.6_update.xml"

$OSC api -X PUT '/source/test:release/_meta' --file "$FIXTURES_DIR/prj/test_release.xml"
$OSC api -X PUT '/source/home:Admin/_meta' --file "$FIXTURES_DIR/prj/home_Admin.xml"

Expand Down Expand Up @@ -92,6 +100,24 @@ $OSC commit -m 'Initial commit'
rm -rf "$TMP_DIR"


# create package 'test:leap:15.6/test-pkgA'
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"

$OSC checkout test:leap:15.6
cd "$_"

$OSC mkpac test-pkgA
cd "$_"

cp "$FIXTURES_DIR/pac/test-pkgA-1.spec" test-pkgA.spec
cp "$FIXTURES_DIR/pac/test-pkgA-1.changes" test-pkgA.changes
$OSC add test-pkgA.spec test-pkgA.changes
$OSC commit -m 'Initial commit'

rm -rf "$TMP_DIR"


# create package 'test:devel/test-pkgA'
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"
Expand Down
65 changes: 65 additions & 0 deletions behave/features/branch.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Feature: `osc branch` command


@destructive
Scenario: Run `osc branch` on an inherited package that has no devel project set
When I execute osc with args "branch test:leap:15.6:update/test-pkgA"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin:branches:test:leap:15.6/test-pkgA/_link"
And stdout contains "<link project=\"test:leap:15.6\""


@destructive
Scenario: Run `osc branch --nodevelproject` on an inherited package that has no devel project set
When I execute osc with args "branch test:leap:15.6:update/test-pkgA"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin:branches:test:leap:15.6/test-pkgA/_link"
And stdout contains "<link project=\"test:leap:15.6\""


@destructive
Scenario: Run `osc branch --new-package` on an inherited package that has no devel project set
When I execute osc with args "branch --new-package test:leap:15.6:update/test-pkgA"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin:branches:test:leap:15.6:update/test-pkgA/_link"
And stdout contains "<link project=\"test:leap:15.6:update\""


@destructive
Scenario: Run `osc branch` on a package that has a devel project set
When I execute osc with args "branch test:factory/test-pkgA"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin:branches:test:devel/test-pkgA/_link"
And stdout contains "<link project=\"test:devel\""


@destructive
Scenario: Run `osc branch --nodevelproject` on a package that has a devel project set
When I execute osc with args "branch --nodevelproject test:factory/test-pkgA"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin:branches:test:factory/test-pkgA/_link"
And stdout contains "<link project=\"test:factory\""


@destructive
Scenario: Run `osc branch` on an inherited package that has a devel project set
When I execute osc with args "branch test:factory:update/test-pkgA"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin:branches:test:devel/test-pkgA/_link"
And stdout contains "<link project=\"test:devel\""


@destructive
Scenario: Run `osc branch --nodevelproject` on an inherited package that has a devel project set
When I execute osc with args "branch --nodevelproject test:factory:update/test-pkgA"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin:branches:test:factory/test-pkgA/_link"
And stdout contains "<link project=\"test:factory\""


@destructive
Scenario: Run `osc branch --new-package` on a package that doesn't exist
When I execute osc with args "branch --new-package test:factory/test-pkgNEW"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin:branches:test:factory/test-pkgNEW/_link"
And stdout contains "<link project=\"test:factory\""
3 changes: 3 additions & 0 deletions behave/features/list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Scenario: Run `osc list` with no arguments to display all projects
openSUSE.org
test:devel
test:factory
test:factory:update
test:leap:15.6
test:leap:15.6:update
test:release
"""

Expand Down
4 changes: 2 additions & 2 deletions behave/features/repo.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Scenario: Run `osc repo add` on a project

@destructive
Scenario: Run `osc repo remove` on a project
When I execute osc with args "repo remove --yes test:factory --repo=standard --repo=does-not-exist"
And I execute osc with args "repo list test:factory"
When I execute osc with args "repo remove --yes test:factory:update --repo=standard --repo=does-not-exist"
And I execute osc with args "repo list test:factory:update"
Then stdout is
"""
"""
11 changes: 11 additions & 0 deletions behave/features/service.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: `osc service` command


Scenario: Run `osc service manualrun`
Given I set working directory to "{context.osc.temp}"
And I execute osc with args "checkout test:factory test-pkgA"
And I set working directory to "{context.osc.temp}/test:factory/test-pkgA"
And I copy file "{context.fixtures}/pac/_service-set_version-invalid" to "{context.osc.temp}/test:factory/test-pkgA/_service"
When I execute osc with args "service manualrun"
Then stdout contains "Aborting: service call failed"
And the exit code is 255
1 change: 1 addition & 0 deletions behave/features/token.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Scenario: Run `osc token` with no arguments
"""


@destructive
Scenario: Run `osc token --operation rebuild`
When I execute osc with args "token --create --operation rebuild test:factory test-pkgA"
Then stdout matches
Expand Down
5 changes: 3 additions & 2 deletions behave/features/undelete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Scenario: Run `osc undelete <project>/<package>`

@destructive
Scenario: Run `osc undelete <project>`
Given I execute osc with args "rdelete test:factory --recursive -m 'why:delete'"
When I execute osc with args "undelete test:factory -m 'why:undelete'"
Given I execute osc with args "rdelete test:factory:update --recursive -m 'why:delete'"
And the exit code is 0
When I execute osc with args "undelete test:factory:update -m 'why:undelete'"
Then the exit code is 0
5 changes: 5 additions & 0 deletions behave/fixtures/pac/_service-set_version-invalid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<services>
<service name="set_version" mode="manual">
<param name="fromfile">invalid</param>
</service>
</services>
25 changes: 25 additions & 0 deletions behave/fixtures/prj/test_factory_update.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<project name="test:factory:update">

<title/>
<description/>

<link project="test:factory"/>

<person userid="Admin" role="maintainer"/>

<lock>
<disable/>
</lock>

<build>
<disable/>
</build>

<repository name="standard">
<path project="test:factory" repository="standard"/>
<arch>x86_64</arch>
<arch>i586</arch>
</repository>

</project>

24 changes: 24 additions & 0 deletions behave/fixtures/prj/test_leap_15.6.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<project name="test:leap:15.6">

<title/>
<description/>

<person userid="Admin" role="maintainer"/>

<lock>
<disable/>
</lock>

<build>
<disable/>
</build>

<repository name="standard">
<!-- it's only for test purposes, let's use the same repo as test:factory -->
<path project="openSUSE.org:openSUSE:Tumbleweed" repository="standard"/>
<arch>x86_64</arch>
<arch>i586</arch>
</repository>

</project>

25 changes: 25 additions & 0 deletions behave/fixtures/prj/test_leap_15.6_update.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<project name="test:leap:15.6:update">

<title/>
<description/>

<link project="test:leap:15.6"/>

<person userid="Admin" role="maintainer"/>

<lock>
<disable/>
</lock>

<build>
<disable/>
</build>

<repository name="standard">
<path project="test:leap:15.6" repository="standard"/>
<arch>x86_64</arch>
<arch>i586</arch>
</repository>

</project>

Loading

0 comments on commit 493f786

Please sign in to comment.