-
Notifications
You must be signed in to change notification settings - Fork 5
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
FI-2647 Add TestKit metadata DRAFT #476
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
require_relative '../repositories/test_kits' | ||
require_relative '../repositories/test_suites' | ||
|
||
module Inferno | ||
module Entities | ||
# @example | ||
# | ||
# module USCoreTestKit | ||
# class TestKit < Inferno::Entities::TestKit | ||
# id :us_core | ||
# title 'US Core Test Kit' | ||
# description <<~DESCRIPTION | ||
# This is a big markdown description of the test kit. | ||
# DESCRIPTION | ||
# suite_ids ['us_core_v311', 'us_core_v400', 'us_core_v501', 'us_core_v610'] | ||
# tags ['SMART App Launch', 'US Core'] | ||
# last_updated '2024-03-07' | ||
# version '0.6.4' | ||
# maturity 'High' | ||
# authors ['Author One', 'Author Two'] | ||
# repo 'https://github.com/inferno-framework/us-core-test-kit' | ||
# end | ||
# end | ||
class TestKit | ||
class << self | ||
def inherited(inheriting_class) | ||
super | ||
inheriting_class.define_singleton_method(:inherited) do |subclass| | ||
copy_instance_variables(subclass) | ||
end | ||
end | ||
|
||
# Set/get the id for the test kit | ||
# | ||
# @param new_id [Symbol, String] | ||
# @return [Symbol, String] | ||
def id(new_id = nil) | ||
return @id if new_id.nil? | ||
|
||
@id = new_id | ||
end | ||
|
||
# Set/get the title for the test kit | ||
# | ||
# @param new_title [String] | ||
# @return [String] | ||
def title(new_title = nil) | ||
return @title if new_title.nil? | ||
|
||
@title = new_title | ||
end | ||
|
||
# Set/get the description for the test kit | ||
# | ||
# @param new_description [String] | ||
# @return [String] | ||
def description(new_description = nil) | ||
return @description if new_description.nil? | ||
|
||
@description = new_description | ||
end | ||
|
||
# Set/get the tags for the test kit | ||
# | ||
# @param new_tags [Array<String>] | ||
# @return [Array<String>] | ||
def tags(new_tags = nil) | ||
return @tags if new_tags.nil? | ||
|
||
@tags = new_tags | ||
end | ||
|
||
# Set/get the last updated date for the test kit | ||
# | ||
# @param new_last_updated [String] | ||
# @return [String] | ||
def last_updated(new_last_updated = nil) | ||
return @last_updated if new_last_updated.nil? | ||
|
||
@last_updated = new_last_updated | ||
end | ||
|
||
# Set/get the version for the test kit | ||
# | ||
# @param new_version [String] | ||
# @return [String] | ||
def version(new_version = nil) | ||
return @version if new_version.nil? | ||
|
||
@version = new_version | ||
end | ||
|
||
# Set/get the maturity level for the test kit | ||
# | ||
# @param new_maturity [String] | ||
# @return [String] | ||
def maturity(new_maturity = nil) | ||
return @maturity if new_maturity.nil? | ||
|
||
@maturity = new_maturity | ||
end | ||
|
||
# Set/get the suite ids for the test kit | ||
# | ||
# @param new_ids [Array<Symbol,String>] | ||
# @return [Array<Symbol,String>] | ||
def suite_ids(new_ids = nil) | ||
return @suite_ids || [] if new_ids.nil? | ||
|
||
@suite_ids = new_ids | ||
end | ||
|
||
# Set/get the code repository url for the test kit | ||
# | ||
# @param new_repo [String] | ||
# @return [String] | ||
def repo(new_repo = nil) | ||
return @repo if new_repo.nil? | ||
|
||
@repo = new_repo | ||
end | ||
|
||
# Set/get the list of authors for the test kit | ||
# | ||
# @param new_authors [Array<String>] | ||
# @return [Array<String>] | ||
def authors(new_authors = nil) | ||
return @authors if new_authors.nil? | ||
|
||
@authors = new_authors | ||
end | ||
|
||
# Get the suites whose ids are defined in `suite_ids` | ||
# | ||
# @return [Array<Inferno::Entities::TestSuite>] | ||
def suites | ||
return @suites if @suites.present? | ||
|
||
repo = Inferno::Repositories::TestSuites.new | ||
@suites = suite_ids.map { |id| repo.find(id) } | ||
end | ||
|
||
# Get the options for the suites in the test kit | ||
# | ||
# @return [Hash{Symbol,String=>Array<Inferno::DSL::SuiteOption>}] | ||
def options | ||
return @options if @options.present? | ||
|
||
@options = suites.each_with_object({}) { |suite, hash| hash[suite.id] = suite.suite_options } | ||
end | ||
|
||
# @private | ||
def add_self_to_repository | ||
repository.insert(self) | ||
end | ||
|
||
# @private | ||
def repository | ||
@repository ||= Inferno::Repositories::TestKits | ||
end | ||
|
||
# @private | ||
def copy_instance_variables | ||
instance_variables | ||
.reject { |variable| [:id].include? variable } | ||
.each { |variable| subclass.instance_variable_set(variable, instance_variable_get(variable).dup) } | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require_relative 'in_memory_repository' | ||
|
||
module Inferno | ||
module Repositories | ||
# Repository that deals with persistence for the `TestKit` entity. | ||
class TestKits < InMemoryRepository | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one other idea i had was for maybe documenting extra services / tools loaded into the test kit at this level (e.g. reference-server). Which, yeah, has to be well synchronized with docker-compose and nginx etc, but i'd think is where the information should belong. Perhaps we just kick that down the road a bit, as it would involve lots more thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think we should take that on yet.