-
Notifications
You must be signed in to change notification settings - Fork 372
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
Bug fixes for test results #2732
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,20 +26,23 @@ jobs: | |
|
||
- bash: $(Build.SourcesDirectory)/tests_e2e/pipeline/scripts/execute_tests.sh | ||
displayName: "Execute tests" | ||
continueOnError: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test failures should not stop the pipeline, so we allow this task to continue on error |
||
env: | ||
# Add all KeyVault secrets explicitly as they're not added by default to the environment vars | ||
AZURE_CLIENT_ID: $(AZURE-CLIENT-ID) | ||
AZURE_CLIENT_SECRET: $(AZURE-CLIENT-SECRET) | ||
AZURE_TENANT_ID: $(AZURE-TENANT-ID) | ||
SUBSCRIPTION_ID: $(SUBSCRIPTION-ID) | ||
|
||
- publish: $(Build.ArtifactStagingDirectory) | ||
artifact: 'artifacts' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
displayName: 'Publish test artifacts' | ||
|
||
- task: PublishTestResults@2 | ||
displayName: 'Publish test results' | ||
inputs: | ||
testResultsFormat: 'JUnit' | ||
testResultsFiles: '**/*junit.xml' | ||
testResultsFiles: 'lisa/agent.junit.xml' | ||
searchFolder: $(Build.ArtifactStagingDirectory) | ||
testRunTitle: 'Publish test results' | ||
failTaskOnFailedTests: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the Execute Tests tasks fails, the build is declared as a Partial Success. This forces the build to Fail on test failures There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how this flag(failTaskOnFailedTests) is related and only checks for execute-tests status? will this not run if I have test failures? I think we need all the time to know summary of failures and successes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The task will mark itself as Failed, but it won't prevent it from publishing the results from https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/publish-test-results-v2 failTaskOnFailedTests - Fail if there are test failures Optional. When this boolean's value is true, the task will fail if any of the tests in the results file are marked as failed. The default is false, which will simply publish the results from the results file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (see run 5534 for an example) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for explaining, makes sense. I see few runs with warning sign. what is that mean? we have some warnings in test but no failures? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are partial success (reported as "[Build partially succeeded] ...- WALinuxAgent - 0eeb2c4") The test execution failed (either because we could not execute the tests, or because some test failed), but I forced the Pipeline to continueOnError when the test execution task fails. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW - In those test runs there are no test results due to a bug in LISA. I reported it this morning and they will fix it. |
||
|
||
- publish: $(Build.ArtifactStagingDirectory) | ||
artifact: 'test-logs' | ||
displayName: 'Publish test logs' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ concurrency: 10 | |
|
||
notifier: | ||
- type: env_stats | ||
- type: junit | ||
- type: agent.junit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created a custom JUnit notifier for the Agent |
||
|
||
include: | ||
- path: ./include/ssh_proxy.yml | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Microsoft Azure Linux Agent | ||
# | ||
# Copyright 2018 Microsoft Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
from dataclasses import dataclass | ||
from typing import Type | ||
|
||
from dataclasses_json import dataclass_json | ||
|
||
from lisa.notifiers.junit import JUnit | ||
from lisa import schema | ||
from lisa.messages import ( | ||
MessageBase, | ||
TestResultMessage, | ||
) | ||
|
||
|
||
@dataclass_json() | ||
@dataclass | ||
class AgentJUnitSchema(schema.Notifier): | ||
path: str = "agent.junit.xml" | ||
|
||
|
||
class AgentJUnit(JUnit): | ||
@classmethod | ||
def type_name(cls) -> str: | ||
return "agent.junit" | ||
|
||
@classmethod | ||
def type_schema(cls) -> Type[schema.TypedSchema]: | ||
return AgentJUnitSchema | ||
|
||
def _received_message(self, message: MessageBase) -> None: | ||
if isinstance(message, TestResultMessage): | ||
distro = message.information.get('distro_version') | ||
if distro is not None: | ||
message.name = distro | ||
super()._received_message(message) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We replace the test name (which is always "main" in our test runs) with the distro name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now this is handled in execute_tests.sh