Skip to content

Commit c7cacdc

Browse files
konturam-blaha
authored andcommitted
Add tests for full use case of storing and replaying a transaction
1 parent 4af4b3d commit c7cacdc

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
Feature: Store and replay transaction tests
2+
3+
4+
Scenario: Replay a stored install transaction with relative path
5+
Given I set working directory to "{context.dnf.tempdir}"
6+
And I use repository "transaction-sr"
7+
When I execute dnf with args "install top-a-1.0 --store ./install_trans"
8+
Then the exit code is 0
9+
And DNF Transaction is following
10+
| Action | Package |
11+
| install | top-a-1:1.0-1.x86_64 |
12+
| install-dep | bottom-a2-0:1.0-1.x86_64 |
13+
| install-dep | bottom-a3-0:1.0-1.x86_64 |
14+
| install-dep | mid-a1-0:1.0-1.x86_64 |
15+
| install-weak | mid-a2-0:1.0-1.x86_64 |
16+
And RPMDB Transaction is empty
17+
When I execute dnf with args "replay ./install_trans"
18+
Then the exit code is 0
19+
And Transaction is following
20+
| Action | Package |
21+
| install | top-a-1:1.0-1.x86_64 |
22+
| install-dep | bottom-a2-0:1.0-1.x86_64 |
23+
| install-dep | bottom-a3-0:1.0-1.x86_64 |
24+
| install-dep | mid-a1-0:1.0-1.x86_64 |
25+
| install-weak | mid-a2-0:1.0-1.x86_64 |
26+
When I execute dnf with args "rq --installed --qf '%{{full_nevra}} %{{reason}} %{{from_repo}}\n'"
27+
Then stdout is
28+
"""
29+
bottom-a2-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
30+
bottom-a3-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
31+
mid-a1-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
32+
mid-a2-0:1.0-1.x86_64 Weak Dependency @stored_transaction(transaction-sr)
33+
top-a-1:1.0-1.x86_64 User @stored_transaction(transaction-sr)
34+
"""
35+
36+
37+
Scenario: Replay a stored install transaction with absolute path
38+
Given I use repository "transaction-sr"
39+
When I execute dnf with args "install top-a-1.0 --store {context.dnf.tempdir}/install_trans"
40+
Then the exit code is 0
41+
And DNF Transaction is following
42+
| Action | Package |
43+
| install | top-a-1:1.0-1.x86_64 |
44+
| install-dep | bottom-a2-0:1.0-1.x86_64 |
45+
| install-dep | bottom-a3-0:1.0-1.x86_64 |
46+
| install-dep | mid-a1-0:1.0-1.x86_64 |
47+
| install-weak | mid-a2-0:1.0-1.x86_64 |
48+
And RPMDB Transaction is empty
49+
When I execute dnf with args "replay {context.dnf.tempdir}/install_trans"
50+
Then the exit code is 0
51+
And Transaction is following
52+
| Action | Package |
53+
| install | top-a-1:1.0-1.x86_64 |
54+
| install-dep | bottom-a2-0:1.0-1.x86_64 |
55+
| install-dep | bottom-a3-0:1.0-1.x86_64 |
56+
| install-dep | mid-a1-0:1.0-1.x86_64 |
57+
| install-weak | mid-a2-0:1.0-1.x86_64 |
58+
When I execute dnf with args "rq --installed --qf '%{{full_nevra}} %{{reason}} %{{from_repo}}\n'"
59+
Then stdout is
60+
"""
61+
bottom-a2-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
62+
bottom-a3-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
63+
mid-a1-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
64+
mid-a2-0:1.0-1.x86_64 Weak Dependency @stored_transaction(transaction-sr)
65+
top-a-1:1.0-1.x86_64 User @stored_transaction(transaction-sr)
66+
"""
67+
68+
69+
Scenario: Replay a stored install transaction with no repos configured
70+
Given I set working directory to "{context.dnf.tempdir}"
71+
And I use repository "transaction-sr"
72+
When I execute dnf with args "install top-a-1.0 --store ./install_trans"
73+
Then the exit code is 0
74+
And DNF Transaction is following
75+
| Action | Package |
76+
| install | top-a-1:1.0-1.x86_64 |
77+
| install-dep | bottom-a2-0:1.0-1.x86_64 |
78+
| install-dep | bottom-a3-0:1.0-1.x86_64 |
79+
| install-dep | mid-a1-0:1.0-1.x86_64 |
80+
| install-weak | mid-a2-0:1.0-1.x86_64 |
81+
And RPMDB Transaction is empty
82+
Given I drop repository "transaction-sr"
83+
When I execute dnf with args "replay ./install_trans"
84+
Then the exit code is 0
85+
And Transaction is following
86+
| Action | Package |
87+
| install | top-a-1:1.0-1.x86_64 |
88+
| install-dep | bottom-a2-0:1.0-1.x86_64 |
89+
| install-dep | bottom-a3-0:1.0-1.x86_64 |
90+
| install-dep | mid-a1-0:1.0-1.x86_64 |
91+
| install-weak | mid-a2-0:1.0-1.x86_64 |
92+
When I execute dnf with args "rq --installed --qf '%{{full_nevra}} %{{reason}} %{{from_repo}}\n'"
93+
Then stdout is
94+
"""
95+
bottom-a2-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
96+
bottom-a3-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
97+
mid-a1-0:1.0-1.x86_64 Dependency @stored_transaction(transaction-sr)
98+
mid-a2-0:1.0-1.x86_64 Weak Dependency @stored_transaction(transaction-sr)
99+
top-a-1:1.0-1.x86_64 User @stored_transaction(transaction-sr)
100+
"""
101+
102+

0 commit comments

Comments
 (0)