Skip to content

Commit

Permalink
tests: apt news selectors now use apt-news.service
Browse files Browse the repository at this point in the history
Update the apt news selector test to directly use the apt-news.service.
This will allow us to verify potential apparmor issues for this service
  • Loading branch information
lucasmoura authored and orndorffgrant committed Jul 17, 2024
1 parent bd8e2b0 commit c1c0cf8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 12 deletions.
48 changes: 36 additions & 12 deletions features/apt_messages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,9 @@ Feature: APT Messages
]
}
"""
When I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
When I apt upgrade
Then I will see the following on stdout
"""
Expand All @@ -747,7 +749,9 @@ Feature: APT Messages
]
}
"""
When I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
When I apt upgrade
Then I will see the following on stdout
"""
Expand Down Expand Up @@ -779,7 +783,9 @@ Feature: APT Messages
]
}
"""
When I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
When I apt upgrade
Then I will see the following on stdout:
"""
Expand Down Expand Up @@ -810,7 +816,9 @@ Feature: APT Messages
]
}
"""
When I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
When I apt upgrade
Then I will see the following on stdout:
"""
Expand All @@ -837,7 +845,9 @@ Feature: APT Messages
]
}
"""
When I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
When I apt upgrade
Then I will see the following on stdout:
"""
Expand Down Expand Up @@ -871,7 +881,9 @@ Feature: APT Messages
]
}
"""
And I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
And I apt upgrade
Then I will see the following on stdout:
"""
Expand Down Expand Up @@ -901,7 +913,9 @@ Feature: APT Messages
"""
And I apt install `<package>=<installed_version>`
And I run `apt-mark hold <package>` with sudo
And I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
And I apt upgrade
Then stdout contains substring:
"""
Expand All @@ -927,7 +941,9 @@ Feature: APT Messages
]
}
"""
And I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
And I apt upgrade
Then stdout contains substring:
"""
Expand Down Expand Up @@ -955,7 +971,9 @@ Feature: APT Messages
]
}
"""
And I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
And I apt upgrade
Then stdout contains substring:
"""
Expand Down Expand Up @@ -985,7 +1003,9 @@ Feature: APT Messages
]
}
"""
And I run `pro refresh messages` with sudo
When I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
When I run `systemctl start apt-news.service` with sudo
When I wait `5` seconds
And I apt upgrade
Then stdout contains substring:
"""
Expand Down Expand Up @@ -1014,7 +1034,9 @@ Feature: APT Messages
]
}
"""
And I run `pro refresh messages` with sudo
And I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
And I run `systemctl start apt-news.service` with sudo
And I wait `5` seconds
And I apt upgrade
Then I will see the following on stdout:
"""
Expand Down Expand Up @@ -1045,7 +1067,9 @@ Feature: APT Messages
]
}
"""
And I run `pro refresh messages` with sudo
And I run `rm -rf /var/lib/apt/periodic/update-success-stamp` with sudo
And I run `systemctl start apt-news.service` with sudo
And I wait `5` seconds
And I apt upgrade
Then I will see the following on stdout:
"""
Expand Down
25 changes: 25 additions & 0 deletions features/steps/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ def given_a_machine(
machine_name=machine_name,
)

when_i_run_command(
context,
"systemctl mask apt-news.service",
"with sudo",
machine_name=machine_name,
)

# make sure the machine has up-to-date apt data
when_i_apt_update(context, machine_name=machine_name)

Expand All @@ -116,6 +123,13 @@ def given_a_machine(
context, "python3-coverage", machine_name=machine_name
)

when_i_run_command(
context,
"systemctl unmask apt-news.service",
"with sudo",
machine_name=machine_name,
)

if cleanup:

def cleanup_instance():
Expand Down Expand Up @@ -232,9 +246,20 @@ def given_a_sut_machine(context, series, machine_type):
)
else:
given_a_machine(context, series, machine_type=machine_type)
when_i_run_command(
context,
"systemctl mask apt-news.service",
"with sudo",
)
_update_distro_info_data(context)
when_i_install_uat(context)

when_i_run_command(
context,
"systemctl unmask apt-news.service",
"with sudo",
)

# trigger GH: #3137 on all machines
when_i_run_command(
context,
Expand Down

0 comments on commit c1c0cf8

Please sign in to comment.