Skip to content

Commit

Permalink
Introduce test obsoletes-keep-reason
Browse files Browse the repository at this point in the history
When package is being replaced, new package
must keep reason of obsoleted package.
  • Loading branch information
edcuba authored and Eduard Čuba committed Oct 9, 2017
1 parent 96c7145 commit 48ee082
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 155 deletions.
142 changes: 71 additions & 71 deletions dnf-docker-test/features/history-1.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,100 +3,100 @@ Feature: DNF/Behave test Transaction history - base
@setup
Scenario: Feature Setup
Given repository "test" with packages
| Package | Tag | Value |
| TestA | Requires | TestB |
| TestB | | |
| TestC | | |
| TestD | Requires | TestE |
| TestE | Requires | TestC |
| Package | Tag | Value |
| TestA | Requires | TestB |
| TestB | | |
| TestC | | |
| TestD | Requires | TestE |
| TestE | Requires | TestC |
And repository "updates" with packages
| Package | Tag | Value |
| TestA | Version | 2 |
| TestB | Version | 2 |
| TestC | Version | 2 |
| TestD | Version | 2 |
When I save rpmdb
| Package | Tag | Value |
| TestA | Version | 2 |
| TestB | Version | 2 |
| TestC | Version | 2 |
| TestD | Version | 2 |
When I save rpmdb
And I enable repository "test"

Scenario: Simple transaction
When I save rpmdb
Scenario: History list of simple transaction
When I save rpmdb
And I successfully run "dnf install -y TestA"
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB |
And history should match "install -y TestA" with "Install" and "2" packages
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB |
And history should match "install -y TestA" with "Install" and "2" packages

Scenario: Undo last transaction
When I save rpmdb
When I save rpmdb
And I successfully run "dnf history undo last -y"
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB |
And history should match "history undo last -y" with "Erase" and "2" packages
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB |
And history should match "history undo last -y" with "Erase" and "2" packages

Scenario: Undo last transaction 2
When I save rpmdb
Scenario: Undo last transaction again
When I save rpmdb
And I successfully run "dnf history undo last -y"
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB |
And history should match "history undo last -y" with "Install" and "2" packages
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB |
And history should match "history undo last -y" with "Install" and "2" packages

Scenario: Undo transaction last-2
When I save rpmdb
When I save rpmdb
And I successfully run "dnf history undo last-2 -y"
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB |
And history should match "history undo last-2 -y" with "Erase" and "2" packages
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB |
And history should match "history undo last-2 -y" with "Erase" and "2" packages

Scenario: Redo last transaction
When I save rpmdb
When I save rpmdb
And I successfully run "dnf install -y TestA"
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB |
When I save rpmdb
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB |
When I save rpmdb
And I successfully run "dnf remove -y TestA"
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB |
When I save rpmdb
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB |
When I save rpmdb
And I successfully run "dnf history redo last-1 -y"
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB |
And history should match "history redo last-1 -y" with "Install" and "2" packages
When I save rpmdb
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB |
And history should match "history redo last-1 -y" with "Install" and "2" packages
When I save rpmdb
And I successfully run "dnf history redo last-1 -y"
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB |
And history should match "history redo last-1 -y" with "Erase" and "2" packages
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB |
And history should match "history redo last-1 -y" with "Erase" and "2" packages

Scenario: Update packages
When I save rpmdb
Scenario: History list of update packages
When I save rpmdb
And I successfully run "dnf install -y TestA TestD"
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB, TestC, TestD, TestE |
When I save rpmdb
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestB, TestC, TestD, TestE |
When I save rpmdb
And I enable repository "updates"
And I successfully run "dnf update -y"
Then rpmdb changes are
| State | Packages |
| updated | TestA, TestB, TestC, TestD |
When I successfully run "dnf history"
Then history should match "update -y" with "Update" and "4" package
Then rpmdb changes are
| State | Packages |
| updated | TestA, TestB, TestC, TestD |
When I successfully run "dnf history"
Then history should match "update -y" with "Update" and "4" package

Scenario: Rollback update
When I save rpmdb
When I save rpmdb
And I successfully run "dnf history rollback last-1 -y"
Then rpmdb changes are
| State | Packages |
| downgraded | TestA, TestB, TestC, TestD |
When I save rpmdb
Then rpmdb changes are
| State | Packages |
| downgraded | TestA, TestB, TestC, TestD |
When I save rpmdb
And I successfully run "dnf history rollback last-3 -y"
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB, TestC, TestD, TestE |
Then rpmdb changes are
| State | Packages |
| removed | TestA, TestB, TestC, TestD, TestE |
132 changes: 65 additions & 67 deletions dnf-docker-test/features/history-2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,85 @@ Feature: DNF/Behave test Transaction history [info, list, userinstalled]
@setup
Scenario: Feature Setup
Given repository "test" with packages
| Package | Tag | Value |
| TestA | Requires | TestB |
| TestB | | |
| TestC | | |
| TestD | Requires | TestE |
| TestE | Requires | TestC |
| Package | Tag | Value |
| TestA | Requires | TestB |
| TestB | | |
| TestC | | |
| TestD | Requires | TestE |
| TestE | Requires | TestC |
And repository "updates" with packages
| Package | Tag | Value |
| TestA | Version | 2 |
| TestB | Version | 2 |
| TestC | Version | 2 |
| TestD | Version | 2 |
When I save rpmdb
| Package | Tag | Value |
| TestA | Version | 2 |
| TestB | Version | 2 |
| TestC | Version | 2 |
| TestD | Version | 2 |
When I save rpmdb
And I enable repository "test"

Scenario: List userinstalled
When I save rpmdb
Scenario: List userinstalled packages
When I save rpmdb
And I successfully run "dnf install -y TestA TestE"
Then history userinstalled should
| Action | Packages |
| Match | TestA, TestE |
| Not match | TestB, TestC |
Then history userinstalled should
| Action | Packages |
| Match | TestA, TestE |
| Not match | TestB, TestC |

Scenario: History list single and ranges
When I save rpmdb
Scenario: History list last and range
When I save rpmdb
And I successfully run "dnf install -y TestD"
And I successfully run "dnf remove -y TestE"
Then history "last-1..last" should match "install -y TestD" with "Install" and "1" package
And history "list last-1..last" should match "remove -y TestE" with "Erase" and "3" packages
And history "last" should match "remove -y TestE" with "Erase" and "3" packages
Then history "last-1..last" should match "install -y TestD" with "Install" and "1" package
And history "list last-1..last" should match "remove -y TestE" with "Erase" and "3" packages
And history "last" should match "remove -y TestE" with "Erase" and "3" packages

Scenario: History list package
When I save rpmdb
When I save rpmdb
And I successfully run "dnf install -y TestC"
Then history "TestC" should match "install -y TestC" with "Install" and "1" package
And history "list TestC" should match "remove -y TestE" with "Erase" and "3" packages
Then history "TestC" should match "install -y TestC" with "Install" and "1" package
And history "list TestC" should match "remove -y TestE" with "Erase" and "3" packages

Scenario: History info
When I save rpmdb
Then history info should match
| Key | Value |
| Command Line | install -y TestC |
| Return-Code | Success |
| Install | TestC |
When I successfully run "dnf remove -y TestA"
Then history info should match
| Key | Value |
| Command Line | remove -y TestA |
| Return-Code | Success |
| Erase | TestA, TestB |
When I save rpmdb
Then history info should match
| Key | Value |
| Command Line | install -y TestC |
| Return-Code | Success |
| Install | TestC |
When I successfully run "dnf remove -y TestA"
Then history info should match
| Key | Value |
| Command Line | remove -y TestA |
| Return-Code | Success |
| Erase | TestA, TestB |

Scenario: History info in range
When I save rpmdb
When I save rpmdb
And I successfully run "dnf install -y TestA"
Then history info should match
| Key | Value |
| Command Line | install -y TestA |
| Return-Code | Success |
| Install | TestA, TestB |
When I save rpmdb
Then history info should match
| Key | Value |
| Command Line | install -y TestA |
| Return-Code | Success |
| Install | TestA, TestB |
When I save rpmdb
And I enable repository "updates"
And I successfully run "dnf update -y"
Then history info should match
| Key | Value |
| Command Line | update -y |
| Return-Code | Success |
| Upgrade | TestA, TestB |
| Upgraded | TestA, TestB |
And history info "last-2..last" should match
| Key | Value |
| Return-Code | Success |
| Upgrade | TestA, TestB |
| Upgraded | TestA, TestB |
| Install | TestA, TestB |
| Erase | TestA, TestB |
And history info "TestA" should match
| Key | Value |
| Return-Code | Success |
| Upgrade | TestA, TestB |
| Upgraded | TestA, TestB |
| Install | TestA, TestB, TestC, TestE |
| Erase | TestA, TestB |


Then history info should match
| Key | Value |
| Command Line | update -y |
| Return-Code | Success |
| Upgrade | TestA, TestB |
| Upgraded | TestA, TestB |
And history info "last-2..last" should match
| Key | Value |
| Return-Code | Success |
| Upgrade | TestA, TestB |
| Upgraded | TestA, TestB |
| Install | TestA, TestB |
| Erase | TestA, TestB |
And history info "TestA" should match
| Key | Value |
| Return-Code | Success |
| Upgrade | TestA, TestB |
| Upgraded | TestA, TestB |
| Install | TestA, TestB, TestC, TestE |
| Erase | TestA, TestB |
32 changes: 32 additions & 0 deletions dnf-docker-test/features/obsoletes-keep-reason.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: DNF/Behave test Obsolete keep reason

@setup
Scenario: Feature Setup
Given repository "test" with packages
| Package | Tag | Value |
| TestB | | |
And repository "updates" with packages
| Package | Tag | Value |
| TestA | Obsoletes | TestB |
When I save rpmdb
And I enable repository "test"
And I successfully run "dnf install -y TestB"
Then rpmdb changes are
| State | Packages |
| installed | TestB |

Scenario: Keep reason of obsolete package
When I successfully run "dnf mark remove TestB"
Then history userinstalled should
Action | Packages |
| Not match | TestB |
When I save rpmdb
And I enable repository "updates"
And I successfully run "dnf update -y"
Then rpmdb changes are
| State | Packages |
| installed | TestA |
| removed | TestB |
And history userinstalled should
| Action | Packages |
| Not match | TestA |
26 changes: 13 additions & 13 deletions dnf-docker-test/features/reinstall-notavailable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ Feature: DNF/Behave test reinstall command
@setup
Scenario: Feature Setup
Given repository "test" with packages
| Package | Tag | Value |
| TestA | Requires | TestA-libs |
| TestA-libs | | |
When I save rpmdb
| Package | Tag | Value |
| TestA | Requires | TestA-libs |
| TestA-libs | | |
When I save rpmdb
And I enable repository "test"
And I successfully run "dnf install -y TestA"
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestA-libs |
Then rpmdb changes are
| State | Packages |
| installed | TestA, TestA-libs |

Scenario: Reinstall package
When I save rpmdb
When I save rpmdb
And I enable repository "test"
And I successfully run "dnf reinstall -y TestA-libs"
Then rpmdb changes are
| State | Packages |
| reinstalled | TestA-libs |
Then rpmdb changes are
| State | Packages |
| reinstalled | TestA-libs |

Scenario: Reinstall - pkg not available
When I save rpmdb
When I save rpmdb
And I disable repository "test"
And I run "dnf reinstall -y TestA-libs"
Then the command should fail
Then the command should fail
Loading

0 comments on commit 48ee082

Please sign in to comment.