зеркало из https://github.com/github/dat-science.git
Merge pull request #1 from github/include-a-timestamp-when-publishing-experiment-results
Add :timestamp to publish payload
This commit is contained in:
Коммит
cb33c05b1c
|
@ -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_in_delta Time.now.to_f, payload[:timestamp].to_f, 2.0
|
||||
|
||||
assert payload[:control][:duration]
|
||||
assert_nil payload[:control][:exception]
|
||||
assert_equal :foo, payload[:control][:value]
|
||||
|
|
Загрузка…
Ссылка в новой задаче