E2E test with minikube on gh action (#513)

* add minikube as e2e test server

* fix format

* update env

* force no skip

* fix then

* finish skip test

* add skip blocker

* fix path

* output skipped case

* enable test env var

* final merge

* add missing file
This commit is contained in:
Boshi Lian
2020-11-01 12:30:51 -08:00
committed by GitHub
parent 16845bae1d
commit af7be8603a
8 changed files with 216 additions and 4 deletions

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
namespace k8s.E2E
{
// This TestLogger is to log test cases skipped by accident
// when E2E test runs in github action
[FriendlyName("SkipTestLogger")]
[ExtensionUri("logger://Microsoft/TestPlatform/SkipTestLogger/v1")]
public class SkipTestLogger : ITestLoggerWithParameters
{
public void Initialize(TestLoggerEvents events, Dictionary<string, string> parameters)
{
if (parameters.TryGetValue("file", out var file))
{
InnerInitialize(events, file);
}
else
{
throw new ArgumentNullException("file", "log file path must be set");
}
}
private static void InnerInitialize(TestLoggerEvents events, string file)
{
Console.WriteLine($"using {file} for skipped test case log");
events.TestResult += (sender, args) =>
{
using (var w = File.AppendText(file))
{
if (args.Result.Outcome == TestOutcome.Skipped)
{
w.WriteLine(args.Result.DisplayName);
}
}
};
}
public void Initialize(TestLoggerEvents events, string testRunDirectory)
{
InnerInitialize(events, Path.Combine(testRunDirectory, "skip.log"));
}
}
}