opentelemetry-dotnet-instru.../test/IntegrationTests/BuildTests.cs

72 lines
2.0 KiB
C#

// <copyright file="BuildTests.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// 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.
// </copyright>
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using IntegrationTests.Helpers;
using VerifyXunit;
using Xunit;
namespace IntegrationTests;
[UsesVerify]
public class BuildTests
{
[Fact]
public Task DistributionStructure()
{
var distributionFolder = EnvironmentHelper.GetNukeBuildOutput();
var files = Directory.GetFiles(distributionFolder, "*", SearchOption.AllDirectories);
var relativesPaths = new List<string>(files.Length);
foreach (var file in files)
{
relativesPaths.Add(file.Substring(distributionFolder.Length));
}
relativesPaths.Sort(StringComparer.Ordinal);
var systemName = GetSystemName();
return Verifier.Verify(relativesPaths)
.UseTextForParameters(systemName)
.DisableDiff();
}
private static string GetSystemName()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return "osx";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "linux";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return "windows";
}
return "unknown";
}
}