Skip to content

Commit 9352afb

Browse files
committed
Add test for start timestamp
1 parent 84dda10 commit 9352afb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

test/ci_app_tests/test_basictrace.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Basic smoke tests: create and read a simple trace, test various options
22

33
import json
4+
import time
45
import unittest
56

67
import calipertest as cat
@@ -125,13 +126,21 @@ def test_globals(self):
125126
'CALI_LOG_VERBOSITY' : '0'
126127
}
127128

129+
t_begin = time.time()
128130
query_output = cat.run_test_with_query(target_cmd, query_cmd, caliper_config)
131+
t_end = time.time()
132+
129133
snapshots = cat.get_snapshots_from_text(query_output)
130134

131135
self.assertEqual(len(snapshots), 1)
132136

133137
self.assertTrue(cat.has_snapshot_with_keys(
134-
snapshots, { 'cali.caliper.version' } ) )
138+
snapshots, { 'cali.caliper.version', 'starttime.sec', 'starttime.nsec' } ) )
139+
140+
t_cali = int(snapshots[0]['starttime.sec'])
141+
142+
self.assertLessEqual(int(t_begin), t_cali)
143+
self.assertLessEqual(t_cali, int(t_end))
135144

136145
def test_globals_selection(self):
137146
target_cmd = [ './ci_test_basic' ]

0 commit comments

Comments
 (0)