Skip to content

Commit 8233ab3

Browse files
committed
[revert] tests
1 parent b0b5586 commit 8233ab3

File tree

1 file changed

+3
-112
lines changed

1 file changed

+3
-112
lines changed

tests/Integration/Etcd.Microsoft.Extensions.Configuration.IntegrationTests/ConfigurationBuilderTests.cs

Lines changed: 3 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Etcd.Microsoft.Extensions.Configuration.IntegrationTests;
1313
public class ConfigurationBuilderTests
1414
{
1515
[Test]
16-
public void Build_WithSettingsFromEtcd_ValuesLoaded_AllAddEtcds()
16+
public void Build_WithSettingsFromEtcd_ValuesLoaded()
1717
{
1818
// Arrange
1919

@@ -30,111 +30,6 @@ public void Build_WithSettingsFromEtcd_ValuesLoaded_AllAddEtcds()
3030
PerformTest(config);
3131
}
3232

33-
[Test]
34-
public void Build_WithSettingsFromEtcd_ValuesLoaded_NoPrefix()
35-
{
36-
// Arrange
37-
38-
var credentials = new Credentials("MyUserName", "passw");
39-
var etcdSettings = new EtcdSettings("http://localhost:2379");
40-
41-
var config = new ConfigurationBuilder()
42-
.AddEtcd(credentials, etcdSettings)
43-
.Build();
44-
45-
// Act
46-
PerformTest(config);
47-
}
48-
49-
[Test]
50-
public void Build_WithSettingsFromEtcd_ValuesLoaded_SimplePrefix()
51-
{
52-
// Arrange
53-
54-
var credentials = new Credentials("MyUserName", "passw");
55-
var etcdSettings = new EtcdSettings("http://localhost:2379");
56-
57-
var config = new ConfigurationBuilder()
58-
.AddEtcd(credentials, etcdSettings, "MyPrefix")
59-
.Build();
60-
61-
// Act
62-
PerformTest(config);
63-
}
64-
65-
66-
[Test]
67-
public void Build_WithSettingsFromEtcd_ValuesLoaded_ComplexPrefix()
68-
{
69-
// Arrange
70-
71-
var credentials = new Credentials("MyUserName", "passw");
72-
var etcdSettings = new EtcdSettings("http://localhost:2379");
73-
74-
var config = new ConfigurationBuilder()
75-
.AddEtcd(credentials, etcdSettings, "MYCOMPLEX/prefix", "/")
76-
.Build();
77-
78-
// Act
79-
PerformTest(config);
80-
var testSection = config.GetSection("Settings");
81-
82-
// Assert
83-
Assert.That(testSection["TestKey"], Is.EqualTo("Test value2"));
84-
}
85-
86-
[Test]
87-
public void Build_WithSettingsFromEtcd_ValuesLoaded_ComplexPrefixOverride()
88-
{
89-
// Arrange
90-
91-
var credentials = new Credentials("MyUserName", "passw");
92-
var etcdSettings = new EtcdSettings("http://localhost:2379");
93-
94-
var config = new ConfigurationBuilder()
95-
.AddEtcd(credentials, etcdSettings)
96-
.AddEtcd(credentials, etcdSettings, "MYCOMPLEX/prefix", "/")
97-
.Build();
98-
99-
// Act
100-
PerformTest(config);
101-
var testSection = config.GetSection("Settings");
102-
103-
// Assert
104-
105-
// Only in key MYCOMPLEX/prefix/TestKey the value is "Test value2",
106-
// So because MYCOMPLEX/prefix is loaded after the root folder,
107-
// the value from MyCOMPLEX/prefix overrides the value in the root folder.
108-
Assert.That(testSection["TestKey"], Is.EqualTo("Test value2"));
109-
}
110-
111-
[Test]
112-
public void Build_WithSettingsFromEtcd_ValuesLoaded_ComplexPrefixOverride_WrongOrder()
113-
{
114-
// Arrange
115-
116-
var credentials = new Credentials("MyUserName", "passw");
117-
var etcdSettings = new EtcdSettings("http://localhost:2379");
118-
119-
var config = new ConfigurationBuilder()
120-
.AddEtcd(credentials, etcdSettings, "MYCOMPLEX/prefix", "/")
121-
.AddEtcd(credentials, etcdSettings)
122-
.Build();
123-
124-
// Act
125-
PerformTest(config);
126-
var testSection = config.GetSection("Settings");
127-
128-
// Assert
129-
130-
// Only in key MYCOMPLEX/prefix/TestKey the value is "Test value2",
131-
// But because MYCOMPLEX/prefix is loaded before the other one,
132-
// the value from etcd that is loaded is overridden
133-
// by the value in the root folder.
134-
Assert.That(testSection["TestKey"], Is.EqualTo("Test value"));
135-
}
136-
137-
13833
[Test]
13934
public void Build_WithSettingsFromEtcdAndCredentialsFromEnvironment_ValuesLoaded()
14035
{
@@ -144,7 +39,6 @@ public void Build_WithSettingsFromEtcdAndCredentialsFromEnvironment_ValuesLoaded
14439
Environment.SetEnvironmentVariable("ETCD_TEST_PASSWORD", "passw");
14540

14641
var credentials = new Credentials("MyUserName", "passw");
147-
14842
var envCredentials = Credentials.WithOverrideFromEnvironmentVariables("foo", "bar", "ETCD_TEST_USERNAME", "ETCD_TEST_PASSWORD");
14943
var envCredentials2 = Credentials.WithOverrideFromEnvironmentVariables("MyUserName", "bar", "ETCD_TEST_PASSWORD");
15044

@@ -160,11 +54,9 @@ public void Build_WithSettingsFromEtcdAndCredentialsFromEnvironment_ValuesLoaded
16054
PerformTest(config);
16155

16256
// Assert
163-
16457
Assert.Pass("Credentials info: " + envCredentials.ToString());
16558
}
16659

167-
16860
private static void PerformTest(IConfigurationRoot config)
16961
{
17062
var testSection = config.GetSection("TestSection");
@@ -176,8 +68,7 @@ private static void PerformTest(IConfigurationRoot config)
17668
// Assert
17769

17870
Assert.That(config, Is.Not.Null);
179-
// This test fails
180-
// Assert.That(config.GetChildren().Any());
71+
Assert.That(config.GetChildren().Any());
18172
Assert.That(testAppSection.GetChildren().Any());
18273
Assert.That(complexPrefixSection.GetChildren().Any());
18374

@@ -190,6 +81,6 @@ private static void PerformTest(IConfigurationRoot config)
19081
Assert.That(list[1], Is.EqualTo("Item 2"));
19182
Assert.That(testAppSection["Item1"], Is.EqualTo("1234321"));
19283

193-
Assert.That(complexPrefixSection["TestKey"], Does.StartWith("Test value"));
84+
Assert.That(complexPrefixSection["TestKey"], Is.EqualTo("Test value"));
19485
}
19586
}

0 commit comments

Comments
 (0)