Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
48 changes: 19 additions & 29 deletions service/test/integration/profile_itest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

to be honest, for me more robust way would be to parse output and check its structure than just relying on certain output format or order

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point, fixed now, thanks!

}
}
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
Expand All @@ -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?
Expand Down
Loading