| # Copyright 2020 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| load("//metadata/test_common.star", "test_common") |
| |
| DOC = """ |
| {name}: Helper test verifying reporting {status} status works correctly. Used to |
| verify that the RTD's interface with the RTS is working. |
| """ |
| |
| def _tests(): |
| return [ |
| test_common.define_test( |
| test_name = "report-success", |
| purpose = "report success to the RTS.", |
| doc = DOC.format(name = "report-success", status = "success"), |
| owner_emails = ["chromeos-test-platform-team@google.com"], |
| owner_groups = ["chromeos-test-platform-team"], |
| attrs = ["suite:dummy"], |
| steps = [result_step] |
| ), |
| test_common.define_test( |
| test_name = "report-failure", |
| purpose = "report failure to the RTS.", |
| doc = DOC.format(name = "report-failure", status = "failure"), |
| owner_emails = ["chromeos-test-platform-team@google.com"], |
| owner_groups = ["chromeos-test-platform-team"], |
| attrs = ["suite:dummy"], |
| setup = fail_setup, |
| steps = [result_step] |
| ), |
| test_common.define_test( |
| test_name = "success-with-warnings", |
| purpose = "report success to the RTS despite warning-level errors.", |
| doc = DOC.format( |
| name = "success-with-warnings", |
| status = "a complex success"), |
| owner_emails = ["chromeos-test-platform-team@google.com"], |
| owner_groups = ["chromeos-test-platform-team"], |
| attrs = ["suite:dummy"], |
| setup = warn_setup, |
| steps = [result_step] |
| ), |
| test_common.define_test( |
| test_name = "fail-on-second-err", |
| purpose = "report failure to the RTS if some "+ |
| "but not all errors are critical.", |
| doc = DOC.format(name = "fail-on-second-err", |
| status = "a complex failure"), |
| owner_emails = ["chromeos-test-platform-team@google.com"], |
| owner_groups = ["chromeos-test-platform-team"], |
| attrs = ["suite:dummy"], |
| setup = complex_failure_setup, |
| steps = [result_step] |
| ), |
| test_common.define_test( |
| test_name = "report-skip", |
| purpose = "report skipped test to the RTS.", |
| doc = DOC.format(name = "report-skip", status = "skipped"), |
| owner_emails = ["chromeos-test-platform-team@google.com"], |
| owner_groups = ["chromeos-test-platform-team"], |
| attrs = ["suite:dummy"], |
| setup = skip_setup, |
| steps = [result_step] |
| )] |
| |
| test_warning = struct( |
| source= "test", |
| severity= "warn", |
| ) |
| |
| failed_test_error = struct( |
| source= "test", |
| severity= "critical", |
| ) |
| |
| fail_result = { "errors": [failed_test_error] } |
| fail_setup = test_common.define_setup(setup_config = {"result": fail_result}) |
| |
| warn_result = { "errors": [test_warning] } |
| warn_setup = test_common.define_setup(setup_config = {"result": warn_result}) |
| |
| complex_failure_result = { "errors": [test_warning, failed_test_error] } |
| complex_failure_setup = test_common.define_setup(setup_config = { |
| "result": complex_failure_result |
| }) |
| |
| skip_result = { "errors": [], "skipped": True } |
| skip_setup = test_common.define_setup(setup_config = {"result": skip_result}) |
| |
| result_step = { |
| "method": "result", |
| "common_args": { |
| "request": "dummy-request", |
| }, |
| } |
| |
| TESTS = _tests() |