You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2021/02/25 23:28:46 UTC

[cloudstack] branch 4.13 updated: Adjust tests to fix a problem with the container builders (https://github.com/khos2ow/cloudstack-deb-builder) (#4668)

This is an automated email from the ASF dual-hosted git repository.

rafael pushed a commit to branch 4.13
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.13 by this push:
     new e1f3179  Adjust tests to fix a problem with the container builders (https://github.com/khos2ow/cloudstack-deb-builder) (#4668)
e1f3179 is described below

commit e1f3179446529da3683154c044b15f277d0d7eab
Author: Daniel Augusto Veronezi Salvador <38...@users.noreply.github.com>
AuthorDate: Thu Feb 25 20:28:11 2021 -0300

    Adjust tests to fix a problem with the container builders (https://github.com/khos2ow/cloudstack-deb-builder) (#4668)
    
    * Changes to allow builders containers to build ACS
    
    Co-authored-by: Daniel Augusto Veronezi Salvador <da...@scclouds.com.br>
---
 .../apache/cloudstack/ca/provider/RootCAProviderTest.java | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/plugins/ca/root-ca/src/test/java/org/apache/cloudstack/ca/provider/RootCAProviderTest.java b/plugins/ca/root-ca/src/test/java/org/apache/cloudstack/ca/provider/RootCAProviderTest.java
index d5d6428..1f16360 100644
--- a/plugins/ca/root-ca/src/test/java/org/apache/cloudstack/ca/provider/RootCAProviderTest.java
+++ b/plugins/ca/root-ca/src/test/java/org/apache/cloudstack/ca/provider/RootCAProviderTest.java
@@ -41,6 +41,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -57,12 +58,6 @@ public class RootCAProviderTest {
         f.set(provider, o);
     }
 
-    private void overrideDefaultConfigValue(final ConfigKey configKey, final String name, final Object o) throws IllegalAccessException, NoSuchFieldException {
-        Field f = ConfigKey.class.getDeclaredField(name);
-        f.setAccessible(true);
-        f.set(configKey, o);
-    }
-
     @Before
     public void setUp() throws Exception {
         caKeyPair = CertUtils.generateRandomKeyPair(1024);
@@ -133,17 +128,17 @@ public class RootCAProviderTest {
 
     @Test
     public void testCreateSSLEngineWithoutAuthStrictness() throws Exception {
-        overrideDefaultConfigValue(RootCAProvider.rootCAAuthStrictness, "_defaultValue", "false");
+        provider.rootCAAuthStrictness = Mockito.mock(ConfigKey.class);
+        Mockito.when(provider.rootCAAuthStrictness.value()).thenReturn(Boolean.FALSE);
         final SSLEngine e = provider.createSSLEngine(SSLUtils.getSSLContext(), "/1.2.3.4:5678", null);
-        Assert.assertFalse(e.getUseClientMode());
         Assert.assertFalse(e.getNeedClientAuth());
     }
 
     @Test
     public void testCreateSSLEngineWithAuthStrictness() throws Exception {
-        overrideDefaultConfigValue(RootCAProvider.rootCAAuthStrictness, "_defaultValue", "true");
+        provider.rootCAAuthStrictness = Mockito.mock(ConfigKey.class);
+        Mockito.when(provider.rootCAAuthStrictness.value()).thenReturn(Boolean.TRUE);
         final SSLEngine e = provider.createSSLEngine(SSLUtils.getSSLContext(), "/1.2.3.4:5678", null);
-        Assert.assertFalse(e.getUseClientMode());
         Assert.assertTrue(e.getNeedClientAuth());
     }