зеркало из https://github.com/github/dat-science.git
Add :timestamp to publish payload
Now we can track when a particular result occurred.
This commit is contained in:
Родитель
2fe56209a9
Коммит
3f4c37e92a
|
@ -50,6 +50,8 @@ module Dat
|
|||
def run
|
||||
return run_control unless candidate? && enabled?
|
||||
|
||||
timestamp = Time.now
|
||||
|
||||
if control_runs_first?
|
||||
control = observe_control
|
||||
candidate = observe_candidate
|
||||
|
@ -59,6 +61,7 @@ module Dat
|
|||
end
|
||||
|
||||
payload = {
|
||||
:timestamp => timestamp,
|
||||
:candidate => candidate.payload,
|
||||
:control => control.payload,
|
||||
:first => control_runs_first? ? :control : :candidate
|
||||
|
|
|
@ -106,6 +106,8 @@ class DatScienceExperimentTest < MiniTest::Unit::TestCase
|
|||
assert_equal "foo", payload[:experiment]
|
||||
assert_equal :control, payload[:first]
|
||||
|
||||
assert (Time.now.to_i - payload[:timestamp].to_i) < 10
|
||||
|
||||
assert payload[:control][:duration]
|
||||
assert_nil payload[:control][:exception]
|
||||
assert_equal :foo, payload[:control][:value]
|
||||
|
|
Загрузка…
Ссылка в новой задаче