Skip to content

Commit

Permalink
add test for create admin partition (G-Research#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
larrytamnjong committed Oct 21, 2024
1 parent 5e85ba4 commit d060b21
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Consul.Test/AdminPartitionTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// -----------------------------------------------------------------------
// <copyright file="AdminPartitionTest.cs" company="G-Research Limited">
// Copyright 2020 G-Research Limited
//
// 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.Linq;
using System.Text;
using System.Threading.Tasks;
using NuGet.Versioning;
using Xunit;

namespace Consul.Test
{
public class AdminPartitionTest : BaseFixture
{
[EnterpriseOnlyFact]
public async Task AdminPartition_CreateAdminPartition()
{
var cutOffVersion = SemanticVersion.Parse("1.11.0");
Skip.If(AgentVersion < cutOffVersion, $"Current version is {AgentVersion}, but `Admin Partition` is only supported from Consul {cutOffVersion}");

var check = new Partition { Name = "na-west", Description = "Partition for North America West" };

var request = await _client.AdminPartition.Create(check);

Assert.Equal(check.Name, request.Response.Name);
}
}
}

0 comments on commit d060b21

Please sign in to comment.