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

spec file is much to slow #142

Closed
opoudjis opened this issue Sep 18, 2024 · 0 comments · Fixed by #144
Closed

spec file is much to slow #142

opoudjis opened this issue Sep 18, 2024 · 0 comments · Fixed by #144
Assignees
Labels
enhancement New feature or request

Comments

@opoudjis
Copy link
Contributor

opoudjis commented Sep 18, 2024

spec/metanorma/plugin/lutaml/lutaml_uml_datamodel_description_preprocessor_spec.rb is so structured that this gem's rake job is taking literally TWO HOURS to run on Github Actions:

https://github.com/metanorma/metanorma-plugin-lutaml/actions/runs/10628356603

This is because it is recompiling the test Asciidoctor document for each and every instance of include_example. There are dozens of them. And the test document is unchanged across a dozen or more executions in each test.

This needs to be sped up. In cases like:

describe "#process" do
    let(:example_file) { fixtures_path("large_test.xmi") }
    let(:config_file) do
      fixtures_path("lutaml_uml_datamodel_description_config.yml")
    end

    context "when there is an options file" do
      let(:input) do
        <<~TEXT
...
        TEXT
      end
      subject (:output) { metanorma_process(input) }

      # @note datamodel_description_sections.xml
      context "correctly renders input" do
        # expect(xml_string_content(metanorma_process(input)))
        #     .to(be_equivalent_to(xml_string_content(output)))

        include_examples "should contain preface"
        include_examples "should contain sections"
        include_examples "should contain text", "Diagram text"
        include_examples "should contain text", "my text"
        include_examples "should contain text", "mine text"
        include_examples "should contain package content", "Another"
        include_examples "should contain table title"
        include_examples "should contain table headers"
        include_examples "should contain package content", "CityGML"
        include_examples "should contain text after package",
                         "Additional information",
                         "text after Another package"
        include_examples "should contain text after package",
                         "Additional information",
                         "text after CityGML package"
        include_examples "should contain footer text"

the step metanorma_process(input) should be run ONLY ONCE, and the include_examples should be replaced by scanning the IDENTICAL output string, and checking it for inclusions:

context "correctly renders input" do
  output = metanorma_process(input)
  expect(output).to include "preface"
  expect(output).to include "sections"

and whatever other substitutions you need to do to make it work.

@opoudjis opoudjis added the enhancement New feature or request label Sep 18, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Metanorma Sep 18, 2024
@kwkwan kwkwan linked a pull request Sep 19, 2024 that will close this issue
4 tasks
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Metanorma Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants