2020from errortracker import cassandra
2121
2222
23- @pytest .fixture (scope = "function " )
23+ @pytest .fixture (scope = "class " )
2424def temporary_db ():
2525 cassandra .KEYSPACE = "tmp"
2626 cassandra .REPLICATION_FACTOR = 1
@@ -29,7 +29,7 @@ def temporary_db():
2929 management .drop_keyspace (cassandra .KEYSPACE )
3030
3131
32- @pytest .fixture (scope = "function " )
32+ @pytest .fixture (scope = "class " )
3333def retracer (temporary_db ):
3434 temp = Path (tempfile .mkdtemp ())
3535 config_dir = temp / "config"
@@ -54,11 +54,12 @@ def datetime_now():
5454 return datetime .now ()
5555
5656
57- @pytest .fixture (scope = "function " )
57+ @pytest .fixture (scope = "class " )
5858def cassandra_data (datetime_now , temporary_db ):
59- import bson
6059 import logging
6160
61+ import bson
62+
6263 from daisy .submit import submit
6364
6465 # disable daisy logger temporarily
@@ -105,15 +106,15 @@ def new_oops(days_ago, data, systemid="imatestsystem"):
105106 # no-crashes-today package version 1 (old version with crashes)
106107 for i in [30 , 20 , 10 , 5 , 2 ]:
107108 new_oops (i , {"DistroRelease" : "Ubuntu 24.04" , "Package" : "no-crashes-today 1" , "ProblemType" : "Crash" , "Architecture" : "amd64" , "ExecutablePath" : "/usr/bin/no-crashes-today" , "StacktraceAddressSignature" : "/usr/bin/no-crashes-today:1:/usr/bin/no-crashes-today+10" })
108-
109+
109110 # no-crashes-today package version 2 (no crashes today - last crash was yesterday)
110111 for i in [5 , 3 , 1 ]:
111112 new_oops (i , {"DistroRelease" : "Ubuntu 24.04" , "Package" : "no-crashes-today 2" , "ProblemType" : "Crash" , "Architecture" : "amd64" , "ExecutablePath" : "/usr/bin/no-crashes-today" , "StacktraceAddressSignature" : "/usr/bin/no-crashes-today:2:/usr/bin/no-crashes-today+20" })
112113
113114 # few-crashes package version 1 (old version with crashes)
114115 for i in [30 , 20 , 10 , 5 , 2 ]:
115116 new_oops (i , {"DistroRelease" : "Ubuntu 24.04" , "Package" : "few-crashes 1" , "ProblemType" : "Crash" , "Architecture" : "amd64" , "ExecutablePath" : "/usr/bin/few-crashes" , "StacktraceAddressSignature" : "/usr/bin/few-crashes:1:/usr/bin/few-crashes+10" })
116-
117+
117118 # few-crashes package version 2 (only 2 crashes today - less than threshold of 3)
118119 for i in [0 , 0 ]:
119120 new_oops (i , {"DistroRelease" : "Ubuntu 24.04" , "Package" : "few-crashes 2" , "ProblemType" : "Crash" , "Architecture" : "amd64" , "ExecutablePath" : "/usr/bin/few-crashes" , "StacktraceAddressSignature" : "/usr/bin/few-crashes:2:/usr/bin/few-crashes+20" })
@@ -125,7 +126,7 @@ def new_oops(days_ago, data, systemid="imatestsystem"):
125126 # low-difference package version 1 (old version with consistent crashes)
126127 for i in [30 , 29 , 28 , 27 , 26 , 25 , 24 , 23 , 22 , 21 , 20 , 19 , 18 , 17 , 16 , 15 , 14 , 13 , 12 , 11 , 10 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 ]:
127128 new_oops (i , {"DistroRelease" : "Ubuntu 24.04" , "Package" : "low-difference 1" , "ProblemType" : "Crash" , "Architecture" : "amd64" , "ExecutablePath" : "/usr/bin/low-difference" , "StacktraceAddressSignature" : "/usr/bin/low-difference:1:/usr/bin/low-difference+10" })
128-
129+
129130 # low-difference package version 2 (similar crash rate to version 1, so difference should be low)
130131 # Only 1 crash today which is less than the expected average
131132 for i in [0 ]:
@@ -134,7 +135,7 @@ def new_oops(days_ago, data, systemid="imatestsystem"):
134135 # all-proposed package version 1
135136 for i in [30 , 20 , 10 ]:
136137 new_oops (i , {"DistroRelease" : "Ubuntu 24.04" , "Package" : "all-proposed 1" , "ProblemType" : "Crash" , "Architecture" : "amd64" , "ExecutablePath" : "/usr/bin/all-proposed" , "StacktraceAddressSignature" : "/usr/bin/all-proposed:1:/usr/bin/all-proposed+10" })
137-
138+
138139 # all-proposed package version 2 (all crashes today are from proposed)
139140 for i in [0 , 0 , 0 , 0 ]:
140141 new_oops (i , {"DistroRelease" : "Ubuntu 24.04" , "Package" : "all-proposed 2" , "ProblemType" : "Crash" , "Architecture" : "amd64" , "ExecutablePath" : "/usr/bin/all-proposed" , "StacktraceAddressSignature" : "/usr/bin/all-proposed:2:/usr/bin/all-proposed+20" , "Tags" : "package-from-proposed" })
0 commit comments