Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TestTimeRecord #113

Merged
merged 2 commits into from
Nov 25, 2019
Merged

Add TestTimeRecord #113

merged 2 commits into from
Nov 25, 2019

Conversation

jessicaxiejw
Copy link

Adding the class to store the run time of individual test during a grind in Redis.

Related https://github.com/Shopify/test-infra/issues/36

You can see the entire change at https://github.com/Shopify/ci-queue/pull/112/files

Comment on lines 55 to 61
def key_to_list_all_test_names
"build:#{config.build_id}:list_of_test_names".force_encoding(Encoding::BINARY)
end

def test_time_key(test_name)
"build:#{config.build_id}:#{test_name}".force_encoding(Encoding::BINARY)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method names test_time_key and key_to_list_all_test_names are somewhat inconsistent.

redis = Redis.new(url: redis_url)
redis.flushdb

config ||= CI::Queue::Configuration.new(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use ||= here?

Comment on lines +5 to +7
redis_url = "redis://#{ENV.fetch('REDIS_HOST', 'localhost')}/7"
redis = Redis.new(url: redis_url)
redis.flushdb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: this same pattern is used in multiple places, it would be nice to move this into a test helper module that any test can include if it needs a local Redis instance (more DRY). Feel free to ignore this for this PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, I'll add it in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create an issue for that and add it to the kanban board, so that this doesn't get lost?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, issue created: #114

@jessicaxiejw jessicaxiejw merged commit a2ef547 into master Nov 25, 2019
@jessicaxiejw jessicaxiejw deleted the add_test_time_record branch November 25, 2019 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants