-
2️⃣ @shinya.maedaAnother sample
<?xml version="1.0" encoding="UTF-8"?> <testsuite name="rspec" tests="38" skipped="0" failures="5" errors="0" time="7.547706" timestamp="2018-07-12T14:48:10+09:00" hostname="shinya-MS-7A34"> <properties> <property name="seed" value="55136"/> </properties> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should belong to user" file="./spec/models/clusters/cluster_spec.rb" time="0.012571"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should have many projects" file="./spec/models/clusters/cluster_spec.rb" time="0.001655"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should have one provider_gcp" file="./spec/models/clusters/cluster_spec.rb" time="0.002588"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should have one platform_kubernetes" file="./spec/models/clusters/cluster_spec.rb" time="0.002927"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should have one application_helm" file="./spec/models/clusters/cluster_spec.rb" time="0.003740"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should have one application_ingress" file="./spec/models/clusters/cluster_spec.rb" time="0.002539"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should have one application_prometheus" file="./spec/models/clusters/cluster_spec.rb" time="0.002330"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should have one application_runner" file="./spec/models/clusters/cluster_spec.rb" time="0.002291"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should delegate #status to #provider object" file="./spec/models/clusters/cluster_spec.rb" time="0.001859"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should delegate #status_reason to #provider object" file="./spec/models/clusters/cluster_spec.rb" time="0.001699"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should delegate #status_name to #provider object" file="./spec/models/clusters/cluster_spec.rb" time="0.001618"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should delegate #on_creation? to #provider object" file="./spec/models/clusters/cluster_spec.rb" time="0.001629"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster should respond to #project" file="./spec/models/clusters/cluster_spec.rb" time="0.002659"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster.enabled should contain exactly #<Clusters::Cluster id: 1, user_id: 1, provider_type: nil, platform_type: nil, created_at: "2018-07-1...15", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">" file="./spec/models/clusters/cluster_spec.rb" time="0.162101"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster.disabled should not contain exactly #<Clusters::Cluster id: 3, user_id: 3, provider_type: nil, platform_type: nil, created_at: "2018-07-1...5", updated_at: "2018-07-12 05:48:15", enabled: false, name: "test-cluster", environment_scope: "*">" file="./spec/models/clusters/cluster_spec.rb" time="0.040580"><failure message="expected [#<Clusters::Cluster id: 3, user_id: 3, provider_type: nil, platform_type: nil, created_at: "2018-07-...", updated_at: "2018-07-12 05:48:15", enabled: false, name: "test-cluster", environment_scope: "*">] not to contain exactly #<Clusters::Cluster id: 3, user_id: 3, provider_type: nil, platform_type: nil, created_at: "2018-07-1...5", updated_at: "2018-07-12 05:48:15", enabled: false, name: "test-cluster", environment_scope: "*">" type="RSpec::Expectations::ExpectationNotMetError">Failure/Error: it { is_expected.not_to contain_exactly(cluster) } expected [#<Clusters::Cluster id: 3, user_id: 3, provider_type: nil, platform_type: nil, created_at: "2018-07-...", updated_at: "2018-07-12 05:48:15", enabled: false, name: "test-cluster", environment_scope: "*">] not to contain exactly #<Clusters::Cluster id: 3, user_id: 3, provider_type: nil, platform_type: nil, created_at: "2018-07-1...5", updated_at: "2018-07-12 05:48:15", enabled: false, name: "test-cluster", environment_scope: "*"> ./spec/models/clusters/cluster_spec.rb:39:in `block (3 levels) in <top (required)>'</failure></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster.user_provided should not contain exactly #<Clusters::Cluster id: 6, user_id: 5, provider_type: 0, platform_type: 1, created_at: "2018-07-12 05...15", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">" file="./spec/models/clusters/cluster_spec.rb" time="0.143197"><failure message="expected [#<Clusters::Cluster id: 6, user_id: 5, provider_type: 0, platform_type: 1, created_at: "2018-07-12 0...5", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">] not to contain exactly #<Clusters::Cluster id: 6, user_id: 5, provider_type: 0, platform_type: 1, created_at: "2018-07-12 05...15", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">" type="RSpec::Expectations::ExpectationNotMetError">Failure/Error: it { is_expected.not_to contain_exactly(cluster) } expected [#<Clusters::Cluster id: 6, user_id: 5, provider_type: 0, platform_type: 1, created_at: "2018-07-12 0...5", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">] not to contain exactly #<Clusters::Cluster id: 6, user_id: 5, provider_type: 0, platform_type: 1, created_at: "2018-07-12 05...15", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*"> ./spec/models/clusters/cluster_spec.rb:51:in `block (3 levels) in <top (required)>'</failure></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster.gcp_provided should not contain exactly #<Clusters::Cluster id: 12, user_id: 10, provider_type: 1, platform_type: 1, created_at: "2018-07-12 ...15", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">" file="./spec/models/clusters/cluster_spec.rb" time="0.106604"><failure message="expected [#<Clusters::Cluster id: 12, user_id: 10, provider_type: 1, platform_type: 1, created_at: "2018-07-12...5", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">] not to contain exactly #<Clusters::Cluster id: 12, user_id: 10, provider_type: 1, platform_type: 1, created_at: "2018-07-12 ...15", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">" type="RSpec::Expectations::ExpectationNotMetError">Failure/Error: it { is_expected.not_to contain_exactly(cluster) } expected [#<Clusters::Cluster id: 12, user_id: 10, provider_type: 1, platform_type: 1, created_at: "2018-07-12...5", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*">] not to contain exactly #<Clusters::Cluster id: 12, user_id: 10, provider_type: 1, platform_type: 1, created_at: "2018-07-12 ...15", updated_at: "2018-07-12 05:48:15", enabled: true, name: "test-cluster", environment_scope: "*"> ./spec/models/clusters/cluster_spec.rb:63:in `block (3 levels) in <top (required)>'</failure></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster.gcp_installed should not contain exactly #<Clusters::Cluster id: 17, user_id: 15, provider_type: 1, platform_type: 1, created_at: "2018-07-12 ...16", updated_at: "2018-07-12 05:48:16", enabled: true, name: "test-cluster", environment_scope: "*">" file="./spec/models/clusters/cluster_spec.rb" time="0.124144"><failure message="expected [#<Clusters::Cluster id: 17, user_id: 15, provider_type: 1, platform_type: 1, created_at: "2018-07-12...6", updated_at: "2018-07-12 05:48:16", enabled: true, name: "test-cluster", environment_scope: "*">] not to contain exactly #<Clusters::Cluster id: 17, user_id: 15, provider_type: 1, platform_type: 1, created_at: "2018-07-12 ...16", updated_at: "2018-07-12 05:48:16", enabled: true, name: "test-cluster", environment_scope: "*">" type="RSpec::Expectations::ExpectationNotMetError">Failure/Error: it { is_expected.not_to contain_exactly(cluster) } expected [#<Clusters::Cluster id: 17, user_id: 15, provider_type: 1, platform_type: 1, created_at: "2018-07-12...6", updated_at: "2018-07-12 05:48:16", enabled: true, name: "test-cluster", environment_scope: "*">] not to contain exactly #<Clusters::Cluster id: 17, user_id: 15, provider_type: 1, platform_type: 1, created_at: "2018-07-12 ...16", updated_at: "2018-07-12 05:48:16", enabled: true, name: "test-cluster", environment_scope: "*"> ./spec/models/clusters/cluster_spec.rb:75:in `block (3 levels) in <top (required)>'</failure></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by user when name is empty should not be falsey" file="./spec/models/clusters/cluster_spec.rb" time="0.040976"><failure message="expected: truthy value got: false" type="RSpec::Expectations::ExpectationNotMetError">Failure/Error: it { is_expected.not_to be_falsey } expected: truthy value got: false ./spec/models/clusters/cluster_spec.rb:88:in `block (6 levels) in <top (required)>'</failure></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by user when name is nil should be falsey" file="./spec/models/clusters/cluster_spec.rb" time="0.040323"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by user when name is present should be truthy" file="./spec/models/clusters/cluster_spec.rb" time="0.040159"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by gcp when name is shorter than 1 should be falsey" file="./spec/models/clusters/cluster_spec.rb" time="0.060831"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by gcp when name is longer than 63 should be falsey" file="./spec/models/clusters/cluster_spec.rb" time="0.062776"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by gcp when name includes invalid character should be falsey" file="./spec/models/clusters/cluster_spec.rb" time="0.059264"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by gcp when name is present should be truthy" file="./spec/models/clusters/cluster_spec.rb" time="0.058836"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by gcp when record is persisted when name is changed should be falsey" file="./spec/models/clusters/cluster_spec.rb" time="0.066672"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates name when provided by gcp when record is persisted when name is same should be truthy" file="./spec/models/clusters/cluster_spec.rb" time="0.072063"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates restrict_modification when creation is on going should be falsey" file="./spec/models/clusters/cluster_spec.rb" time="0.050091"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster validation when validates restrict_modification when creation is done should be truthy" file="./spec/models/clusters/cluster_spec.rb" time="0.068641"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#provider when provider is gcp returns a provider" file="./spec/models/clusters/cluster_spec.rb" time="0.065312"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#provider when provider is user should be nil" file="./spec/models/clusters/cluster_spec.rb" time="0.043133"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#platform when platform is kubernetes returns a platform" file="./spec/models/clusters/cluster_spec.rb" time="0.050245"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#first_project when cluster belongs to a project should eq #<Project id:1 namespace1/project1>" file="./spec/models/clusters/cluster_spec.rb" time="0.405136"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#first_project when cluster does not belong to projects should be nil" file="./spec/models/clusters/cluster_spec.rb" time="0.019359"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#applications when none of applications are created returns a list of a new objects" file="./spec/models/clusters/cluster_spec.rb" time="0.034485"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#applications when applications are created returns a list of created applications" file="./spec/models/clusters/cluster_spec.rb" time="0.046891"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#created? when status_name is :created should eq true" file="./spec/models/clusters/cluster_spec.rb" time="0.066585"></testcase> <testcase classname="spec.models.clusters.cluster_spec" name="Clusters::Cluster#created? when status_name is not :created should eq false" file="./spec/models/clusters/cluster_spec.rb" time="0.067676"></testcase> </testsuite>
-
2️⃣ @shinya.maeda -
2️⃣ @shinya.maedaTest
stream = Ci::Build.last.job_artifacts_junit.open Gitlab::Ci::Build::Artifacts::XML.new(stream).each_hash { |file_name, xml| puts xml; }
Result
{ "testsuite" => { "name" => "rspec", "tests" => "2", "skipped" => "0", "failures" => "1", "errors" => "0", "time" => "8.699514", "timestamp" => "2018-07-10T14:14:56+09:00", "hostname" => "shinya-MS-7A34", "properties" => { "property" => { "name" => "seed", "value" => "57143" } }, "testcase" => [{ "classname" => "spec.workers.archive_trace_worker_spec", "name" => "ArchiveTraceWorker#perform when job is found executes service", "file" => "./spec/workers/archive_trace_worker_spec.rb", "time" => "1.769739" }, { "classname" => "spec.workers.archive_trace_worker_spec", "name" => "ArchiveTraceWorker#perform when job is not found does not execute service", "file" => "./spec/workers/archive_trace_worker_spec.rb", "time" => "0.020027", "failure" => "Failure/Error: expect(2).to be 1\n\n expected #<Integer:3> => 1\n got #<Integer:5> => 2\n\n Compared using equal?, which compares object identity,\n but expected and actual are not the same object. Use\n `expect(actual).to eq(expected)` if you don't care about\n object identity in this example.\n./spec/workers/archive_trace_worker_spec.rb:21:in `block (4 levels) in <top (required)>'" }] } } { "testsuite" => { "name" => "rspec", "tests" => "38", "skipped" => "0", "failures" => "5", "errors" => "0", "time" => "7.547706", "timestamp" => "2018-07-12T14:48:10+09:00", "hostname" => "shinya-MS-7A34", "properties" => { "property" => { "name" => "seed", "value" => "55136" } }, "testcase" => [{ "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should belong to user", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.012571" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should have many projects", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.001655" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should have one provider_gcp", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.002588" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should have one platform_kubernetes", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.002927" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should have one application_helm", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.003740" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should have one application_ingress", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.002539" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should have one application_prometheus", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.002330" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should have one application_runner", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.002291" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should delegate #status to #provider object", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.001859" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should delegate #status_reason to #provider object", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.001699" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should delegate #status_name to #provider object", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.001618" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster should delegate #on_creation? to #provider object", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.001629" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Clustershould respond to #project", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.002659" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster.enabled should contain exactly #<Clusters::Cluster id: 1, user_id: 1, provider_type: nil, platform_type: nil, created_at: \"2018-07-1...15\", updated_at: \"2018-07-12 05:48:15\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.162101" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster.disabled should not contain exactly #<Clusters::Cluster id: 3, user_id: 3, provider_type: nil, platform_type: nil, created_at: \"2018-07-1...5\", updated_at: \"2018-07-12 05:48:15\", enabled: false, name: \"test-cluster\", environment_scope: \"*\">", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.040580", "failure" => "Failure/Error: it { is_expected.not_to contain_exactly(cluster) }\n expected [#<Clusters::Cluster id: 3, user_id: 3, provider_type: nil, platform_type: nil, created_at: \"2018-07-...\", updated_at: \"2018-07-12 05:48:15\", enabled: false, name: \"test-cluster\", environment_scope: \"*\">] not to contain exactly #<Clusters::Cluster id: 3, user_id: 3, provider_type: nil, platform_type: nil, created_at: \"2018-07-1...5\", updated_at: \"2018-07-12 05:48:15\", enabled: false, name: \"test-cluster\", environment_scope: \"*\">\n./spec/models/clusters/cluster_spec.rb:39:in `block (3 levels) in <top (required)>'" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster.user_provided should not contain exactly #<Clusters::Cluster id: 6, user_id: 5, provider_type: 0, platform_type: 1, created_at: \"2018-07-12 05...15\", updated_at: \"2018-07-12 05:48:15\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.143197", "failure" => "Failure/Error: it { is_expected.not_to contain_exactly(cluster) }\n expected [#<Clusters::Cluster id: 6, user_id: 5, provider_type: 0, platform_type: 1, created_at: \"2018-07-12 0...5\", updated_at: \"2018-07-12 05:48:15\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">] not to contain exactly #<Clusters::Cluster id: 6, user_id: 5, provider_type: 0, platform_type: 1, created_at: \"2018-07-12 05...15\", updated_at: \"2018-07-1205:48:15\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">\n./spec/models/clusters/cluster_spec.rb:51:in `block (3 levels) in <top (required)>'" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster.gcp_provided should not contain exactly #<Clusters::Cluster id: 12, user_id: 10, provider_type: 1, platform_type: 1, created_at: \"2018-07-12 ...15\", updated_at: \"2018-07-12 05:48:15\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.106604", "failure" => "Failure/Error: it { is_expected.not_to contain_exactly(cluster) }\n expected [#<Clusters::Cluster id: 12, user_id: 10, provider_type: 1, platform_type: 1, created_at: \"2018-07-12...5\", updated_at: \"2018-07-12 05:48:15\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">] not to contain exactly #<Clusters::Cluster id: 12, user_id: 10, provider_type: 1, platform_type: 1, created_at: \"2018-07-12 ...15\", updated_at: \"2018-07-12 05:48:15\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">\n./spec/models/clusters/cluster_spec.rb:63:in `block (3 levels) in <top (required)>'" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster.gcp_installed should not contain exactly #<Clusters::Cluster id: 17, user_id: 15, provider_type: 1, platform_type: 1, created_at: \"2018-07-12 ...16\", updated_at: \"2018-07-12 05:48:16\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.124144", "failure" => "Failure/Error: it { is_expected.not_to contain_exactly(cluster) }\n expected [#<Clusters::Cluster id: 17, user_id: 15, provider_type: 1, platform_type: 1, created_at: \"2018-07-12...6\", updated_at: \"2018-07-12 05:48:16\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">] not to contain exactly #<Clusters::Cluster id: 17,user_id: 15, provider_type: 1, platform_type: 1, created_at: \"2018-07-12 ...16\", updated_at: \"2018-07-12 05:48:16\", enabled: true, name: \"test-cluster\", environment_scope: \"*\">\n./spec/models/clusters/cluster_spec.rb:75:in `block (3 levels) in <top (required)>'" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by user when name is empty should notbe falsey", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.040976", "failure" => "Failure/Error: it { is_expected.not_to be_falsey }\n\n expected: truthy value\n got: false\n./spec/models/clusters/cluster_spec.rb:88:in `block (6 levels) in <top (required)>'" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by user when name is nil should be falsey", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.040323" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by user when name is present should be truthy", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.040159" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by gcp when name is shorter than 1 should be falsey", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.060831" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by gcp when name is longer than 63 should be falsey", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.062776" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by gcp when name includes invalid character should be falsey", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.059264" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by gcp when name is present should be truthy", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.058836" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by gcp when record is persisted when name is changed should be falsey", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.066672" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates name when provided by gcp when record is persisted when name is same should be truthy", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.072063" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validatesrestrict_modification when creation is on going should be falsey", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.050091" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster validation when validates restrict_modification when creation is done should be truthy", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.068641" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#provider when provider is gcp returns a provider", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.065312" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#provider when provider is user should be nil", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.043133" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#platform when platform is kubernetes returns a platform", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.050245" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#first_project when cluster belongs to a project should eq #<Project id:1 namespace1/project1>", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.405136" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#first_project when cluster does not belong to projects should be nil", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.019359" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#applications when none of applications are created returns a list of a new objects", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.034485" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#applications when applications are created returns a list of created applications", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.046891" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#created? when status_name is :created should eq true", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.066585" }, { "classname" => "spec.models.clusters.cluster_spec", "name" => "Clusters::Cluster#created? when status_name is not :created should eq false", "file" => "./spec/models/clusters/cluster_spec.rb", "time" => "0.067676" }] } }
-
2️⃣ @shinya.maedaKarma: https://github.com/karma-runner/karma-junit-reporter
<?xml version="1.0"?> <testsuite name="PhantomJS 1.9.8 (Linux)" package="models" timestamp="2015-03-10T13:59:23" id="0" hostname="admin" tests="629" errors="0" failures="0" time="11.452"> <properties> <property name="browser.fullName" value="Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"/> </properties> <testcase name="(C.2) Checks if an empty object is returned when error 404 is encountered" time="0.01" classname="PhantomJS_1_9_8_(Linux).models.AnalyticsModule_test"/> <testcase name="(C.3) Checks if an empty array is returned when error 405 is encountered" time="0.013" classname="PhantomJS_1_9_8_(Linux).models.AnalyticsModule_test"/> </testsuite> ...
Python: https://github.com/karma-runner/karma-junit-reporter
<?xml version="1.0" ?> <testsuites> <testsuite errors="0" failures="0" name="my test suite" tests="1"> <testcase classname="some.class.name" name="Test1" time="123.345000"> <system-out> I am stdout! </system-out> <system-err> I am stderr! </system-err> </testcase> </testsuite> </testsuites>
-
2️⃣ @shinya.maeda -
2️⃣ @shinya.maedaSample 1
[25] pry(main)> Ci::Pipeline.find(45).test_results Ci::Pipeline Load (0.4ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 45]] Ci::Build Load (0.5ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 AND (EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 4)) [["commit_id", 45]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 589], ["file_type", 4]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 588], ["file_type", 4]] => #<Gitlab::Ci::Build::Artifacts::TestResults:0x000055b723813488 @summary=#<Gitlab::Ci::Build::Artifacts::TestResult::TestSummary:0x000055b723813460 @error_count=0, @failure_count=0, @skipped_count=0, @success_count=6, @test_count=6, @total_time=0.0021969999999999997>, @test_case_results= {"rspec"=> [#<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b7235c33b8 @classname="spec.string_helper_spec", @failure_reason=nil, @file="./spec/string_helper_spec.rb", @key="spec-string-helper-spec-StringHelper-concatenate-when-a-is-git-and-b-is-lab-returns-summary", @name="StringHelper#concatenate when a is git and b is lab returns summary", @result=:success, @time="0.000305">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b7235c2e90 @classname="spec.string_helper_spec", @failure_reason=nil, @file="./spec/string_helper_spec.rb", @key="spec-string-helper-spec-StringHelper-concatenate-when-a-is-git-and-b-is-200-raises-an-error", @name="StringHelper#concatenate when a is git and b is 200 raises an error", @result=:success, @time="0.000734">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b7233d7e00 @classname="spec.test_spec", @failure_reason=nil, @file="./spec/test_spec.rb", @key="spec-test-spec-Test-sum-when-a-is-1-and-b-is-2-returns-summary", @name="Test#sum when a is 1 and b is 2 returns summary", @result=:success, @time="0.000333">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b7233d7950 @classname="spec.test_spec", @failure_reason=nil, @file="./spec/test_spec.rb", @key="spec-test-spec-Test-sum-when-a-is-100-and-b-is-200-returns-summary", @name="Test#sum when a is 100 and b is 200 returns summary", @result=:success, @time="0.000077">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b7233d76f8 @classname="spec.test_spec", @failure_reason=nil, @file="./spec/test_spec.rb", @key="spec-test-spec-Test-subtract-when-a-is-1-and-b-is-2-raises-an-error", @name="Test#subtract when a is 1 and b is 2 raises an error", @result=:success, @time="0.000684">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b7233d70e0 @classname="spec.test_spec", @failure_reason=nil, @file="./spec/test_spec.rb", @key="spec-test-spec-Test-subtract-when-a-is-2-and-b-is-1-returns-correct-result", @name="Test#subtract when a is 2 and b is 1 returns correct result", @result=:success, @time="0.000064">]}>
Sample 2
=> #<Gitlab::Ci::Build::Artifacts::TestResults:0x000055b722a29c28 @summary=#<Gitlab::Ci::Build::Artifacts::TestResult::TestSummary:0x000055b722a29bb0 @error_count=0, @failure_count=3, @skipped_count=0, @success_count=3, @test_count=6, @total_time=0.021599>, @test_case_results= {"rspec"=> [#<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b722821ae8 @classname="spec.string_helper_spec", @failure_reason= "Failure/Error: is_expected.to eq('gitlab')\n" + "\n" + " expected: \"gitlab\"\n" + " got: \"git lab\"\n" + "\n" + " (compared using ==)\n" + "./spec/string_helper_spec.rb:12:in `block (4 levels) in <top (required)>'", @file="./spec/string_helper_spec.rb", @key="spec-string-helper-spec-StringHelper-concatenate-when-a-is-git-and-b-is-lab-returns-summary", @name="StringHelper#concatenate when a is git and b is lab returns summary", @result=:failed, @time="0.010007">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b7228217c8 @classname="spec.string_helper_spec", @failure_reason=nil, @file="./spec/string_helper_spec.rb", @key="spec-string-helper-spec-StringHelper-concatenate-when-a-is-git-and-b-is-200-raises-an-error", @name="StringHelper#concatenate when a is git and b is 200 raises an error", @result=:success, @time="0.000757">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b72264e9f0 @classname="spec.test_spec", @failure_reason="Failure/Error: is_expected.to eq(3)\n" + "\n" + " expected: 3\n" + " got: -1\n" + "\n" + " (compared using ==)\n" + "./spec/test_spec.rb:12:in `block (4 levels) in <top (required)>'", @file="./spec/test_spec.rb", @key="spec-test-spec-Test-sum-when-a-is-1-and-b-is-2-returns-summary", @name="Test#sum when a is 1 and b is 2 returns summary", @result=:failed, @time="0.009873">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b72262a820 @classname="spec.test_spec", @failure_reason= "Failure/Error: is_expected.to eq(300)\n" + "\n" + " expected: 300\n" + " got: -100\n" + "\n" + " (compared using ==)\n" + "./spec/test_spec.rb:21:in `block (4 levels) in <top (required)>'", @file="./spec/test_spec.rb", @key="spec-test-spec-Test-sum-when-a-is-100-and-b-is-200-returns-summary", @name="Test#sum when a is 100 and b is 200 returns summary", @result=:failed, @time="0.000177">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b722628f20 @classname="spec.test_spec", @failure_reason=nil, @file="./spec/test_spec.rb", @key="spec-test-spec-Test-subtract-when-a-is-1-and-b-is-2-raises-an-error", @name="Test#subtract when a is 1 and b is 2 raises an error", @result=:success, @time="0.000713">, #<Gitlab::Ci::Build::Artifacts::TestResult::TestCase:0x000055b722628ac0 @classname="spec.test_spec", @failure_reason=nil, @file="./spec/test_spec.rb", @key="spec-test-spec-Test-subtract-when-a-is-2-and-b-is-1-returns-correct-result", @name="Test#subtract when a is 2 and b is 1 returns correct result", @result=:success, @time="0.000072">]}>
-
2️⃣ @shinya.maedaSample comparison results
[1] pry(main)> Ci::Pipeline.find(47).test_results.compare_failed_tests(Ci::Pipeline.find(45).test_results) Ci::Pipeline Load (0.4ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 47]] Ci::Build Load (1.1ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 AND (EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 4)) [["commit_id", 47]] Ci::JobArtifact Load (0.3ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 593], ["file_type", 4]] Ci::JobArtifact Load (0.3ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 592], ["file_type", 4]] Ci::Pipeline Load (0.2ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 45]] Ci::Build Load (0.6ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 AND (EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 4)) [["commit_id", 45]] Ci::JobArtifact Load (0.3ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 589], ["file_type", 4]] Ci::JobArtifact Load (0.4ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 588], ["file_type", 4]] => {:new=> ["spec-string-helper-spec-StringHelper-concatenate-when-a-is-git-and-b-is-lab-returns-summary", "spec-test-spec-Test-sum-when-a-is-1-and-b-is-2-returns-summary", "spec-test-spec-Test-sum-when-a-is-100-and-b-is-200-returns-summary"], :resolved=>[], :existing=>[]} [2] pry(main)> Ci::Pipeline.find(45).test_results.compare_failed_tests(Ci::Pipeline.find(47).test_results) Ci::Pipeline Load (0.5ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 45]] Ci::Build Load (0.5ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 AND (EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 4)) [["commit_id", 45]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 589], ["file_type", 4]] Ci::JobArtifact Load (0.2ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 588], ["file_type", 4]] Ci::Pipeline Load (0.2ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 47]] Ci::Build Load (0.5ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 AND (EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 4)) [["commit_id", 47]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 593], ["file_type", 4]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 592], ["file_type", 4]] => {:new=>[], :resolved=> ["spec-string-helper-spec-StringHelper-concatenate-when-a-is-git-and-b-is-lab-returns-summary", "spec-test-spec-Test-sum-when-a-is-1-and-b-is-2-returns-summary", "spec-test-spec-Test-sum-when-a-is-100-and-b-is-200-returns-summary"], :existing=>[]} [3] pry(main)> Ci::Pipeline.find(48).test_results.compare_failed_tests(Ci::Pipeline.find(47).test_results) Ci::Pipeline Load (0.4ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 48]] Ci::Build Load (0.5ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 AND (EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 4)) [["commit_id", 48]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 595], ["file_type", 4]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 594], ["file_type", 4]] Ci::Pipeline Load (0.2ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 47]] Ci::Build Load (0.8ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 AND (EXISTS (SELECT 1 FROM "ci_job_artifacts" WHERE (ci_builds.id = ci_job_artifacts.job_id) AND "ci_job_artifacts"."file_type" = 4)) [["commit_id", 47]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 593], ["file_type", 4]] Ci::JobArtifact Load (0.2ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 592], ["file_type", 4]] => {:new=>[], :resolved=>[], :existing=> ["spec-string-helper-spec-StringHelper-concatenate-when-a-is-git-and-b-is-lab-returns-summary", "spec-test-spec-Test-sum-when-a-is-1-and-b-is-2-returns-summary", "spec-test-spec-Test-sum-when-a-is-100-and-b-is-200-returns-summary"]} [4] pry(main)>
-
2️⃣ @shinya.maeda -
2️⃣ @shinya.maeda -
2️⃣ @shinya.maedaSample gitlab-ci.yml to test JUnit test report on the merge request widget.
rspec 0 3: stage: test script: - bundle install - bundle exec rspec spec/test_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: reports: junit: rspec.xml rspec 1 3: stage: test script: - bundle install - bundle exec rspec spec/string_helper_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: reports: junit: rspec.xml rspec 2 3: stage: test script: - bundle install - bundle exec rspec spec/hash_scan_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: reports: junit: rspec.xml java 0 3: image: openjdk:11-jdk stage: test script: - apt-get update && apt-get install -y ant - cd junit-example - ant test artifacts: reports: junit: junit-example/TEST-CalculatorTest.xml
Here is a project which includes the gitlab-ci.yml and application/test codes
Edited by Shinya Maeda -
2️⃣ @shinya.maedaTest 1
rspec 0 3: stage: test script: - bundle install - bundle exec rspec spec/test_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: paths: [rspec.xml] reports: junit: rspec.xml rspec 1 3: stage: test script: - bundle install - bundle exec rspec spec/string_helper_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: paths: [rspec.xml] reports: junit: rspec.xml rspec 2 3: stage: test script: - bundle install - bundle exec rspec spec/hash_scan_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: paths: [rspec.xml] reports: junit: rspec.xml java 0 3: image: openjdk:11-jdk stage: test script: - apt-get update && apt-get install -y ant - cd junit-example - ant test artifacts: paths: [junit-example/TEST-CalculatorTest.xml] reports: junit: junit-example/TEST-CalculatorTest.xml
Result 1
[15] pry(main)> Ci::Pipeline.find(164).builds.map { |build| build.job_artifacts.map { |artifact| [build.name, artifact.file.filename, artifact.file.exists?] } } Ci::Pipeline Load (0.3ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 164]] Ci::Build Load (0.3ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 [["commit_id", 164]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1557]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1556]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1555]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1554]] => [[["java 0 3", "job.log", true], ["java 0 3", "junit.xml.gz", true]], [["rspec 2 3", "artifacts.zip", true], ["rspec 2 3", "metadata.gz", true], ["rspec 2 3", "junit.xml.gz", true], ["rspec 2 3", "job.log", true]], [["rspec 1 3", "artifacts.zip", true], ["rspec 1 3", "metadata.gz", true], ["rspec 1 3", "job.log", true], ["rspec 1 3", "junit.xml.gz", true]], [["rspec 0 3", "job.log", true], ["rspec 0 3", "junit.xml.gz", true]]]
Edited by Shinya Maeda -
2️⃣ @shinya.maedaTest 2
rspec 0 3: stage: test script: - bundle install - bundle exec rspec spec/test_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: untracked: true reports: junit: rspec.xml rspec 1 3: stage: test script: - bundle install - bundle exec rspec spec/string_helper_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: untracked: true reports: junit: rspec.xml rspec 2 3: stage: test script: - bundle install - bundle exec rspec spec/hash_scan_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: untracked: true reports: junit: rspec.xml java 0 3: image: openjdk:11-jdk stage: test script: - apt-get update && apt-get install -y ant - cd junit-example - ant test artifacts: untracked: true reports: junit: junit-example/TEST-CalculatorTest.xml
Result
Edited by Shinya Maeda -
2️⃣ @shinya.maedaTest 3
rspec 0 3: stage: test script: - bundle install - bundle exec rspec spec/test_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: untracked: true when: always reports: junit: rspec.xml rspec 1 3: stage: test script: - bundle install - bundle exec rspec spec/string_helper_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: untracked: true when: always reports: junit: rspec.xml rspec 2 3: stage: test script: - bundle install - bundle exec rspec spec/hash_scan_spec.rb --format RspecJunitFormatter --out rspec.xml artifacts: untracked: true when: always reports: junit: rspec.xml java 0 3: image: openjdk:11-jdk stage: test script: - apt-get update && apt-get install -y ant - cd junit-example - ant test artifacts: untracked: true when: always reports: junit: junit-example/TEST-CalculatorTest.xml
[18] pry(main)> Ci::Pipeline.find(167).builds.map { |build| build.job_artifacts.map { |artifact| [build.name, artifact.file.filename, artifact.file.exists?] } } Ci::Pipeline Load (0.3ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 167]] Ci::Build Load (0.3ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 [["commit_id", 167]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1569]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1568]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1567]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1566]] => [[["java 0 3", "job.log", true], ["java 0 3", "artifacts.zip", true], ["java 0 3", "metadata.gz", true], ["java 0 3", "junit.xml.gz", true]], [["rspec 2 3", "job.log", true], ["rspec 2 3", "artifacts.zip", true], ["rspec 2 3", "metadata.gz", true], ["rspec 2 3", "junit.xml.gz", true]], [["rspec 1 3", "job.log", true], ["rspec 1 3", "artifacts.zip", true], ["rspec 1 3", "metadata.gz", true], ["rspec 1 3", "junit.xml.gz", true]], [["rspec 0 3", "artifacts.zip", true], ["rspec 0 3", "metadata.gz", true], ["rspec 0 3", "junit.xml.gz", true], ["rspec 0 3", "job.log", true]]]
Edited by Shinya Maeda -
2️⃣ @shinya.maedaTest
rspec 0 3: stage: test script: - bundle install - bundle exec rspec spec/test_spec.rb --format RspecJunitFormatter --out rspec-1.xml - bundle exec rspec spec/string_helper_spec.rb --format RspecJunitFormatter --out rspec-2.xml - bundle exec rspec spec/hash_scan_spec.rb --format RspecJunitFormatter --out rspec-3.xml artifacts: untracked: true when: always reports: junit: [lrspec-1.xml, lrspec-2.xml, lrspec-3.xml]
Result
[19] pry(main)> Ci::Pipeline.find(168).builds.map { |build| build.job_artifacts.map { |artifact| [build.name, artifact.file.filename, artifact.file.exists?] } } Ci::Pipeline Load (0.3ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 168]] Ci::Build Load (0.3ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 [["commit_id", 168]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1570]] => [[["rspec 0 3", "artifacts.zip", true], ["rspec 0 3", "metadata.gz", true], ["rspec 0 3", "job.log", true]]]
[27] pry(main)> puts Ci::Pipeline.find(168).builds.last.trace.raw Ci::Pipeline Load (0.3ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 168]] Ci::Build Load (0.4ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 ORDER BY "ci_builds"."id" DESC LIMIT 1 [["commit_id", 168]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 AND "ci_job_artifacts"."file_type" = $2 LIMIT 1 [["job_id", 1570], ["file_type", 3]] Running with gitlab-runner 11.1.0~beta.610.gbe367359 (be367359) on test-runner-2 b683320b Using Docker executor with image ruby:2.1 ... Pulling docker image ruby:2.1 ... Using docker image sha256:223d1eaa9523fa64e78f5a92b701c9c11cbc507f0ff62246dbbacdae395ffea3 for ruby:2.1 ... Running on runner-b683320b-project-14-concurrent-0 via shinya-MS-7A34... Fetching changes... Removing junit-example/TEST-CalculatorTest.xml HEAD is now at cdea2d2 always test From http://192.168.10.15:3000/root/junit-xml cdea2d2..f5890d0 runner-qa -> origin/runner-qa Checking out f5890d00 as runner-qa... Skipping Git submodules setup $ bundle install Warning: the running version of Bundler (1.15.1) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. Fetching gem metadata from https://rubygems.org/.......... Fetching version metadata from https://rubygems.org/. Fetching rspec-support 3.7.1 Installing rspec-support 3.7.1 Fetching diff-lcs 1.3 Installing diff-lcs 1.3 Using bundler 1.15.1 Fetching rspec-core 3.7.1 Installing rspec-core 3.7.1 Fetching rspec-expectations 3.7.0 Installing rspec-expectations 3.7.0 Fetching rspec-mocks 3.7.0 Installing rspec-mocks 3.7.0 Fetching rspec_junit_formatter 0.4.1 Installing rspec_junit_formatter 0.4.1 Fetching rspec 3.7.0 Installing rspec 3.7.0 Bundle complete! 2 Gemfile dependencies, 8 gems now installed. Bundled gems are installed into /usr/local/bundle. $ bundle exec rspec spec/test_spec.rb --format RspecJunitFormatter --out rspec-1.xml Uploading artifacts... untracked: found 1 files Uploading artifacts to coordinator... ok id=1570 responseStatus=201 Created token=ydWhdtGg Uploading artifacts... WARNING: lrspec-1.xml: no matching files WARNING: lrspec-2.xml: no matching files WARNING: lrspec-3.xml: no matching files ERROR: No files to upload ERROR: Job failed: exit code 1 => nil
Edited by Shinya Maeda -
2️⃣ @shinya.maedaTest
rspec 0 3: stage: test script: - bundle install - bundle exec rspec spec/test_spec.rb --format RspecJunitFormatter --out rspec-1.xml - bundle exec rspec spec/string_helper_spec.rb --format RspecJunitFormatter --out rspec-2.xml - bundle exec rspec spec/hash_scan_spec.rb --format RspecJunitFormatter --out rspec-3.xml artifacts: untracked: true when: always reports: junit: [rspec-1.xml, rspec-2.xml, rspec-3.xml]
Result
[20] pry(main)> Ci::Pipeline.find(169).builds.map { |build| build.job_artifacts.map { |artifact| [build.name, artifact.file.filename, artifact.file.exists?] } } Ci::Pipeline Load (0.4ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = $1 LIMIT 1 [["id", 169]] Ci::Build Load (0.4ms) SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."commit_id" = $1 [["commit_id", 169]] Ci::JobArtifact Load (0.1ms) SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" = $1 [["job_id", 1571]] => [[["rspec 0 3", "job.log", true], ["rspec 0 3", "artifacts.zip", true], ["rspec 0 3", "metadata.gz", true], ["rspec 0 3", "junit.xml.gz", true]]]
Edited by Shinya Maeda -
2️⃣ @shinya.maeda
Test senario 1: Passed
- There are no pipelines in the project
- Create a running pipeline on
master
andpatch-1
with passed test reports => User should not see test reports - Finish running pipelines => User should see test reports => Test summary: "Test summary contained no changed test results out of 11 total tests" => Testsuite: "rspec:pg found no changed test results out of 11 total tests" => Testsuite: "java ant found no changed test results out of 11 total tests"
Test senario 2: New failure
- There are no pipelines in the project
- Create a running pipeline on
master
andpatch-1
with passed and failed test reports, respectively. => User should not see test reports - Finish running pipelines => User should see test reports => Test summary: "Test summary contained 2 failed test results out of 11 total tests" => Testsuite: "rspec:pg found 2 failed test results out of 2 total tests" => Testsuite: "java ant found no changed test results out of 11 total tests"
- User clicked a failed test link => User should see failed reason
Test senario 3: Mixed results (New/Resolved/existing)
- There are no pipelines in the project
- Create a running pipeline on
master
andpatch-1
with mixed results of test reports. => User should not see test reports - Finish running pipelines => User should see test reports => Test summary: "Test summary contained 2 failed results and 2 fixed test results out of 11 total tests" => Testsuite: "rspec:pg found 1 failed and 2 fixed test results out of 8 total tests" => Testsuite: "java ant found 1 failed test results out of 3 total tests"
- User clicked a passed test link => What is expected behavior?
Test senario 4: New push
- Therea are already test reports on MR widget
- User fixed a test on feature branch => User should not see test reports
- Finish running pipelines => User should see test reports without reloading
Backend TODO:
- status: success/failed
- Fixture things
Tomorrow morning -> meeting
-
2️⃣ @shinya.maeda{ "status": "success", <--- "success/failed" "summary": { "total": 11, "resolved": 2, "failed": 2 }, "suites": [ { "name": "rspec:pg", "summary": { "total": 8, "resolved": 2, "failed": 1 }, "status": "success", <--- "success/failed" "new_failures": [ { "status": "success", <--- "success/failed" "name": "Test#subtract when a is 2 and b is 1 returns correct result", "execution_time": 0.00908, "system_output": "Failure/Error: is_expected.to eq(1)\n\n expected: 1\n got: 3\n\n (compared using ==)\n./spec/test_spec.rb:43:in `block (4 levels) in \u003ctop (required)\u003e'" } ], "resolved_failures": [ { "status": "success", <--- "success/failed" "name": "Test#sum when a is 1 and b is 2 returns summary", "execution_time": 0.000318, "system_output": null }, { "status": "success", "name": "Test#sum when a is 100 and b is 200 returns summary", "execution_time": 7.4e-5, "system_output": null } ], "existing_failures": [] }, { "name": "java ant", "status": "failure", <--- This corresponds to the status icon "summary": { "total": 3, "resolved": 0, "failed": 1 }, "new_failures": [], "resolved_failures": [], "existing_failures": [ { "status": "failure", "name": "sumTest", "execution_time": 0.004, "system_output": "junit.framework.AssertionFailedError: expected:\u003c3\u003e but was:\u003c-1\u003e\n\tat CalculatorTest.sumTest(Unknown Source)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" } ] } ] }
-
2️⃣ @shinya.maedaPrerequisite
- Run GDK and access to http://localhost:3000 on a browser
- Create a project with a name 'test-repo'
- Create a README with whatever content (i.e. Create
master
branch) - Update the README with whatever content and change the branch to
patch-1
(i.e. Create a feature branch) - Create a merge request with
patch-1
Preparation
- Comment out the following code in db/fixtures/development/14_pipelines.rb
Gitlab::Seeder.quiet do Project.all.sample(1).each do |project| project_builds = Gitlab::Seeder::Pipelines.new(project) project_builds.seed! end end
- Execute
bundle exec rails console
(Login to rails console) - Execute
require '/path/to/gdk/db/fixtures/development/14_pipelines'
(Load a seeder)
Example 1: Passed test reports
- To create a running pipeline on
master
branch (i.e. base) with passed test reports, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('master', rspec_pattern: 'pass', ant_pattern: 'pass')
- To create a running pipeline on
patch-1
branch (i.e. head) with passed test reports, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('patch-1', rspec_pattern: 'pass', ant_pattern: 'pass')
- Now you should be able to see a running pipeline on merge request
- To finish the running pipelines, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('master') Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('patch-1')
- Now you should be able to see test reports on the merge request
Example 2: New failed test reports
- To create a running pipeline on
master
branch (i.e. base) with passed test reports, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('master', rspec_pattern: 'pass', ant_pattern: 'pass')
- To create a running pipeline on
patch-1
branch (i.e. head) with failed test reports, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('patch-1', rspec_pattern: 'failed-1', ant_pattern: 'pass')
- Now you should be able to see a running pipeline on merge request
- To finish the running pipelines, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('master') Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('patch-1')
- Now you should be able to see test reports on the merge request
Example 3: Mixed results (new/existing/fixed) test reports
- To create a running pipeline on
master
branch (i.e. base) with passed/failed test reports, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('master', rspec_pattern: 'failed-1', ant_pattern: 'failed-1')
- To create a running pipeline on
patch-1
branch (i.e. head) with passed/failed test reports, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('patch-1', rspec_pattern: 'failed-2', ant_pattern: 'failed-1')
- Now you should be able to see a running pipeline on merge request
- To finish the running pipelines, execute
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('master') Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('patch-1')
- Now you should be able to see test reports on the merge request
Tips: Clean up pipelines
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).destroy_pipeline('master') Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).destroy_pipeline('patch-1')
Edited by Shinya Maeda -
2️⃣ @shinya.maeda -
2️⃣ @shinya.maeda -
2️⃣ @shinya.maedaAdded more examples. Example 4 corresponds to @ayufan's concern described at https://gitlab.com/gitlab-org/gitlab-ce/issues/49966#note_92759159. Example 5 corresponds to my concern described at https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21039#note_92620370.
Plese make sure you've done Prerequisite and Preparation sections in https://gitlab.com/snippets/1731728#note_91233415 before you create fixtures on your GDK.
Example 4: Loading error is recovered after new commit was pushed
- Create a test reports on master branch
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('master', rspec_pattern: 'pass', ant_pattern: 'pass') Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('master')
- Create a corrupted test reports on feature branch
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('patch-1', rspec_pattern: 'corrupted', ant_pattern: 'pass') Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('patch-1')
- Now you should see the loading error "Test summary failed loading results" in the merge request widget
- Create a running pipeline with vaild test reports on feature branch
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('patch-1', rspec_pattern: 'failed-1', ant_pattern: 'pass')
- Finish the pipeline
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('patch-1')
- Now you should see test reports in the merge request widget
Example 5: When test reports have resolved failures, but new and existing failures
- Create failed test reports on master branch
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('master', rspec_pattern: 'failed-1', ant_pattern: 'pass') Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('master')
- Create passed test reports on feature branch
Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).create_running_pipeline_with_test_reports('patch-1', rspec_pattern: 'pass', ant_pattern: 'pass') Gitlab::Seeder::Pipelines.new(Project.find_by_name("test-repo")).finish_last_pipeline('patch-1')
- Now you should see resolved failures in the merge request widget
Edited by Shinya Maeda -
🌴 @reprazentHello?
-
2️⃣ @shinya.maedaaaa
-
2️⃣ @shinya.maedaaa
Please register or sign in to comment