[ 
https://issues.apache.org/jira/browse/GEODE-8128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17134803#comment-17134803
 ] 

ASF GitHub Bot commented on GEODE-8128:
---------------------------------------

mmartell commented on a change in pull request #616:
URL: https://github.com/apache/geode-native/pull/616#discussion_r439741116



##########
File path: cppcache/integration/test/SNITest.cpp
##########
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#include <cstdlib>
+#include <fstream>
+#include <iostream>
+#include <thread>
+
+#include <gtest/gtest.h>
+
+#include <geode/Cache.hpp>
+#include <geode/CacheFactory.hpp>
+#include <geode/RegionFactory.hpp>
+#include <geode/RegionShortcut.hpp>
+
+#include "framework/Cluster.h"
+
+namespace ssltest {
+
+using apache::geode::client::AuthenticationRequiredException;
+using apache::geode::client::CacheableString;
+using apache::geode::client::CacheFactory;
+using apache::geode::client::Exception;
+using apache::geode::client::RegionShortcut;
+
+class SNITest : public ::testing::Test {
+ protected:
+  // You can remove any or all of the following functions if their bodies would
+  // be empty.
+
+  SNITest() {
+    // You can do set-up work for each test here.
+    certificatePassword = std::string("apachegeode");
+    currentWorkingDirectory = boost::filesystem::current_path();
+  }
+
+  ~SNITest() override = default;
+  // You can do clean-up work that doesn't throw exceptions here.
+
+  // If the constructor and destructor are not enough for setting up
+  // and cleaning up each test, you can define the following methods:
+  void SetUp() override {
+    // Code here will be called immediately after the constructor (right
+    // before each test).
+#if defined(_WINDOWS)
+    std::string sniDir(currentWorkingDirectory.string());
+    sniDir += "/../sni-test-config";
+    SetCurrentDirectory(sniDir.c_str());
+#else
+    chdir("./sni-test-config");
+#endif
+
+    std::system("docker-compose up -d");
+
+    std::system(
+        "docker exec -t geode gfsh run "
+        "--file=/geode/scripts/geode-starter.gfsh");
+  }
+
+  void TearDown() override {
+    // Code here will be called immediately after each test (right
+    // before the destructor).
+    std::system("docker-compose stop");
+  }
+
+  std::string makeItSo(const char* command) {
+    std::string commandOutput;
+#if defined(_WINDOWS)
+    std::unique_ptr<FILE, decltype(&_pclose)> pipe(_popen(command, "r"),
+                                                   _pclose);
+#else
+    std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(command, "r"), pclose);
+#endif
+    std::array<char, 128> charBuff;
+    if (!pipe) {
+      throw std::runtime_error("Failed on the POPEN");
+    }
+    while (fgets(charBuff.data(), charBuff.size(), pipe.get()) != nullptr) {
+      commandOutput += charBuff.data();
+    }
+    return commandOutput;
+  }
+
+  int parseProxyPort(std::string proxyString) {
+    // 15443/tcp -> 0.0.0.0:32787
+    std::size_t colonPosition = proxyString.find(":");
+    std::string portNumberString = proxyString.substr((colonPosition + 1));
+    return stoi(portNumberString);
+  }
+
+  // Class members declared here can be used by all tests in the test suite
+  // for Ssl.
+  Cluster cluster = Cluster{LocatorCount{1}, ServerCount{1}};
+  std::string certificatePassword;

Review comment:
       Great catch. We're starting the cluster in a docker container in this 
test so don't need the framework cluster.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Write basic SNI test
> --------------------
>
>                 Key: GEODE-8128
>                 URL: https://issues.apache.org/jira/browse/GEODE-8128
>             Project: Geode
>          Issue Type: Test
>          Components: native client
>            Reporter: Ernest Burghardt
>            Priority: Major
>
> test will interact with docker-compose to construct a cluster and proxy, 
> proxy port host:container will be hardcoded
> test will perform simple put/get via sni proxy



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to