Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve tests #15

Open
gkellogg opened this issue Apr 8, 2021 · 2 comments
Open

Improve tests #15

gkellogg opened this issue Apr 8, 2021 · 2 comments
Labels
feature request New or missing functionality help wanted Great place for a new contribution

Comments

@gkellogg
Copy link
Member

gkellogg commented Apr 8, 2021

From #10 (comment), more shared tests to check Repository conformance, and the set up to run tests on commit through the GitHub Actions CI task.

@gkellogg gkellogg added help wanted Great place for a new contribution feature request New or missing functionality labels Apr 8, 2021
stuzart added a commit that referenced this issue Apr 12, 2021
include the tenforce/virutoso docker container as a service in the github ci.yml
however, currently just the service, not yet included in any tests #15
stuzart added a commit that referenced this issue Apr 12, 2021
a simple check that the repo is connecting and querying within the Github CI environment
stuzart added a commit that referenced this issue Apr 12, 2021
after the container starts, it needs just a couple of seconds to initialise. Hopefully 3s is enough to avoid any sporadic errors #15
stuzart added a commit that referenced this issue Apr 12, 2021
@stuzart
Copy link
Member

stuzart commented Apr 12, 2021

I've made a little start on this on branch, adding the Virtuoso docker service, and a basic test that it is interacting an doing a query. These tests will fail unless the service is available, so I was thinking of checking if an environment variable is set, and otherwise skip (perhaps github sets one?)

I tried adding it_behaves_like "an RDF::Repository" which leads to a lot of errors, but many of which seem to stem from the same place

Failure/Error:
               @statements.each do |st|
                 if st.graph_name.equal?(DEFAULT_GRAPH)
                   st = st.dup
                   st.graph_name = nil
                 end

                 yield st

       NoMethodError:
         undefined method `each' for nil:NilClass
       Shared Example Group: "an RDF::Enumerable" called from /usr/share/rvm/gems/ruby-2.6.6/bundler/gems/rdf-spec-4fe4eb8a3288/lib/rdf/spec/dataset.rb:26
       Shared Example Group: "an RDF::Dataset" called from /usr/share/rvm/gems/ruby-2.6.6/bundler/gems/rdf-spec-4fe4eb8a3288/lib/rdf/spec/repository.rb:23

stuzart added a commit that referenced this issue Apr 12, 2021
the previous one gave a warning
@gkellogg
Copy link
Member Author

It's reasonable for tests to be be conditioned on an environment variable. See, for example, the postgres spec in the otherwise rather obsolete rdf-do gem.

This environment variable can be specified in the .github/workflows/ci.yml file along with starting up the docker image. General documentation for running the specs on the desktop would be useful, too.

It's not too surprising that the it_behaves_like "an RDF::Repository" fails, as the gem predates many of those conventions, so may need some TLC to bring into conformance.

This typically needs some instance variables set up to allow it to work properly. For example:

  # @see lib/rdf/spec/repository.rb in RDF-spec
  it_behaves_like "an RDF::Repository" do
    let(:repository) {@repository}
  end

Where @repository is an instance RDF::Virtuoso::Repository.

Also see rdf-mongo spec.

stuzart added a commit that referenced this issue Apr 13, 2021
check with a single select which is unlikely to change, and also include a simple insert #15
stuzart added a commit that referenced this issue Apr 13, 2021
explicity setting the let(:repository) caused an infinite loop and stack overflow, because the subject is already named it works without #15
gkellogg pushed a commit that referenced this issue Apr 15, 2021
GitHub testing with virtuoso service

* include virtuoso as a service in CI
  * include the tenforce/virutoso docker container as a service in the github ci.yml
however, currently just the service, not yet included in any tests #15
* a basic integration test that does a simple query #15
  * a simple check that the repo is connecting and querying within the Github CI environment
* the default graph is unlikely to be needed #15
* wait 3 seconds extra, to give virtuoso service more time
  * after the container starts, it needs just a couple of seconds to initialise. Hopefully 3s is enough to avoid any sporadic errors #15
* rubocop on integration spec
* uses not run! #15
* include it_behaves_like an RDF::Repository
* try a different sleep action #15
  * the previous one gave a warning
* disable the it_behaves_like check for now #15
* extend tests to check the connection is working and some cleaning up
 * check with a single select which is unlikely to change, and also include a simple insert #15
* fixed invoking it_behaves_like but commented out until resolved
 * explicitly setting the let(:repository) caused an infinite loop and stack overflow, because the subject is already named it works without #15
* control whether the integration tests are run with an env variable #15
* Update spec/integration_spec.rb
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature request New or missing functionality help wanted Great place for a new contribution
Projects
None yet
Development

No branches or pull requests

2 participants