Skip to content

Commit

Permalink
tests: update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dheyay committed Mar 21, 2024
1 parent fd8cfdc commit 17bebb2
Show file tree
Hide file tree
Showing 3 changed files with 407 additions and 26 deletions.
342 changes: 342 additions & 0 deletions features/apt_messages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,348 @@ Feature: APT Messages
| focal | azure.generic | Learn more about Ubuntu Pro on Azure at https://ubuntu.com/azure/pro |
| focal | gcp.generic | Learn more about Ubuntu Pro on GCP at https://ubuntu.com/gcp/pro |

@uses.config.contract_token
Scenario Outline: APT news selectors
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
When I attach `contract_token` with sudo
When I apt upgrade including phased updates
When I apt autoremove
When I apt install `jq`
When I run `pro detach --assume-yes` with sudo
Given a `mantic` `<machine_type>` machine named `apt-news-server`
When I apt install `nginx` on the `apt-news-server` machine
When I run `sed -i "s/gzip on;/gzip on;\n\tgzip_min_length 1;\n\tgzip_types application\/json;\n/" /etc/nginx/nginx.conf` `with sudo` on the `apt-news-server` machine
When I run `systemctl restart nginx` `with sudo` on the `apt-news-server` machine
When I run `pro config set apt_news_url=http://$behave_var{machine-ip apt-news-server}/aptnews.json` with sudo
# Testing codename selector
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"codenames": ["jammy"],
},
"lines": [
"one"
]
}
]
}
"""
When I run `pro refresh messages` with sudo
When I apt upgrade
Then I will see the following on stdout
"""
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
"""
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"codenames": ["mantic"]
},
"lines": [
"one",
"two"
]
}
]
}
"""
When I run `pro refresh messages` with sudo
When I apt upgrade
Then I will see the following on stdout
"""
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
#
# one
# two
#
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
"""
# Testing architectures selector
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"architectures": ["amd64"]
},
"lines": [
"one",
"two"
]
}
]
}
"""
When I run `pro refresh messages` with sudo
When I apt upgrade
Then I will see the following on stdout:
"""
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
#
# one
# two
#
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
"""
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"architectures": ["arm64"]
},
"lines": [
"one",
"two"
]
}
]
}
"""
When I run `pro refresh messages` with sudo
When I apt upgrade
Then I will see the following on stdout:
"""
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
"""
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"architectures": ["arm64", "amd64"]
},
"lines": [
"one",
"two"
]
}
]
}
"""
When I run `pro refresh messages` with sudo
When I apt upgrade
Then I will see the following on stdout:
"""
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
#
# one
# two
#
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
"""
# Testing packages selector when package is not installed
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"codenames": ["mantic"],
"architectures": ["amd64"],
"packages": [["libcurl4", "==", "8.2.1-1ubuntu3"]]
},
"lines": [
"one",
"two"
]
}
]
}
"""
And I run `pro refresh messages` with sudo
And I apt upgrade
Then I will see the following on stdout:
"""
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
"""
# Testing package selector when package installed
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"packages": [["libcurl4", "==", "8.2.1-1ubuntu3"]]
},
"lines": [
"one",
"two"
]
}
]
}
"""
And I apt install `libcurl4=8.2.1-1ubuntu3`
And I run `apt-mark hold libcurl4` with sudo
And I run `pro refresh messages` with sudo
And I apt upgrade
Then stdout matches regexp:
"""
#
# one
# two
#
"""
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"packages": [["libcurl4", "<", "8.2.1-1ubuntu3.2"]]
},
"lines": [
"one",
"two"
]
}
]
}
"""
And I run `pro refresh messages` with sudo
And I apt upgrade
Then stdout matches regexp:
"""
#
# one
# two
#
"""
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"codenames": ["mantic"],
"architectures": ["amd64"],
"packages": [["libcurl4", "==", "8.2.1-1ubuntu3"]]
},
"lines": [
"one",
"two"
]
}
]
}
"""
And I run `pro refresh messages` with sudo
And I apt upgrade
Then stdout matches regexp:
"""
#
# one
# two
#
"""
# Testing multiple selectors together
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"codenames": ["jammy"],
"architectures": ["arm64"],
"packages": [["libcurl4", "==", "8.2.1-1ubuntu3"]]
},
"lines": [
"one",
"two"
]
}
]
}
"""
And I run `pro refresh messages` with sudo
And I apt upgrade
Then I will see the following on stdout:
"""
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages have been kept back:
libcurl4
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
"""
When I create the file `/var/www/html/aptnews.json` on the `apt-news-server` machine with the following:
"""
{
"messages": [
{
"begin": "$behave_var{today}",
"selectors": {
"codenames": ["mantic"],
"architectures": ["amd64"],
"packages": [["libcurl4", ">", "8.2.1-1ubuntu3"]]
},
"lines": [
"one",
"two"
]
}
]
}
"""
And I run `pro refresh messages` with sudo
And I apt upgrade
Then I will see the following on stdout:
"""
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages have been kept back:
libcurl4
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
"""

Examples: ubuntu release
| release | machine_type |
| mantic | lxd-container |

@uses.config.contract_token
Scenario Outline: APT Hook do not advertises esm-apps on upgrade for interim releases
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
Expand Down
Loading

0 comments on commit 17bebb2

Please sign in to comment.