diff --git a/.github/workflows/ci-integration-tests.yml b/.github/workflows/ci-integration-tests.yml index 605e940b7d..bb15b03b7e 100644 --- a/.github/workflows/ci-integration-tests.yml +++ b/.github/workflows/ci-integration-tests.yml @@ -120,5 +120,6 @@ jobs: if: failure() && !github.event.repository.fork && github.event_name != 'workflow_dispatch' with: channel: "#yast" - nickname: github-action + nickname: agama-team-bot + sasl_password: ${{ secrets.AGAMA_TEAM_BOT_PASSWORD }} message: "Agama integration test failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" diff --git a/service/test/integration/profile_itest.rb b/service/test/integration/profile_itest.rb index 55bede8073..31881dcff0 100644 --- a/service/test/integration/profile_itest.rb +++ b/service/test/integration/profile_itest.rb @@ -4,6 +4,7 @@ # TODO: remember to set up and test the --host option after all require "cheetah" +require "json" require "webrick" # @param filename relative to git repo root @@ -75,6 +76,15 @@ def web_server_shutdown(server) end end +shared_examples "JSON output structurally matches trivial_tw" do + it "JSON output structurally matches trivial_tw" do + parsed_output = JSON.parse(output) + expect(parsed_output["product"]["id"]).to eq "Tumbleweed" + expect(parsed_output["software"]["patterns"]).to eq ["base"] + expect(parsed_output["software"]["packages"]).to eq [] + end +end + describe "agama config" do before(:all) do @web_server = web_server_start @@ -203,23 +213,6 @@ def web_server_shutdown(server) describe "generate (autoyast):" do let(:command) { ["agama", "config", "generate"] } - let(:output_match) do - json = <<~JSON - { - "software": { - "patterns": [ - "base" - ], - "packages": [] - }, - "product": { - "id": "Tumbleweed" - } - } - JSON - json - end - # I want to test that YaST special schemes like label: # are handled, but unable to make them work in my testing environment xcontext "XML, with a YaST special URL" do @@ -229,32 +222,29 @@ def web_server_shutdown(server) context "XML, with path" do let(:filename) { "service/test/fixtures/profiles/trivial_tw.xml" } - - it "output matches" do + let(:output) do path = fixture(filename) - output = Cheetah.run(*command, path, stdout: :capture) - expect(output).to include(output_match) + Cheetah.run(*command, path, stdout: :capture) end + include_examples "JSON output structurally matches trivial_tw" end context "XML, with file:/// URL" do let(:filename) { "service/test/fixtures/profiles/trivial_tw.xml" } - - it "output matches" do + let(:output) do url = "file://" + abs_fixture(filename) - output = Cheetah.run(*command, url, stdout: :capture) - expect(output).to include(output_match) + Cheetah.run(*command, url, stdout: :capture) end + include_examples "JSON output structurally matches trivial_tw" end context "ERB, with file:/// URL" do let(:filename) { "service/test/fixtures/profiles/trivial_tw.xml.erb" } - - it "output matches" do + let(:output) do url = "file://" + abs_fixture(filename) - output = Cheetah.run(*command, url, stdout: :capture) - expect(output).to include(output_match) + Cheetah.run(*command, url, stdout: :capture) end + include_examples "JSON output structurally matches trivial_tw" end # I get a deadlock because two processes want the libstorage lock. why?