summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorhwajeong.son <hwajeong.son@samsung.com>2018-08-20 04:20:53 (GMT)
committerhwajeong.son <hwajeong.son@samsung.com>2018-08-20 04:20:53 (GMT)
commit27763b024648b848430481a929d716038d887952 (patch)
treea5388eec33d3b55cbf75e2e1ea360c32de7de78f /unittest
parent81dc7d90889e619942f34c4a584768b4b3179445 (diff)
downloaddocker-adaptor-master.zip
docker-adaptor-master.tar.gz
docker-adaptor-master.tar.bz2
Signed-off-by: hwajeong.son <hwajeong.son@samsung.com>
Diffstat (limited to 'unittest')
-rwxr-xr-xunittest/CMakeLists.txt52
-rwxr-xr-xunittest/beluga-adaptor_interface.cpp135
-rwxr-xr-xunittest/beluga-adaptor_main.cpp13
-rwxr-xr-xunittest/beluga-adaptor_setting.cpp145
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/cert/SRnD+Web+Proxy.crt25
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/config/config.json1
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/config/set_eth_config.sh72
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/config/set_wifi_config.sh79
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/container/config-agent.yml15
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/container/config-service.yml14
-rwxr-xr-xunittest/pre/beluga/system/docker/dockerd_start.json6
-rwxr-xr-xunittest/pre/beluga/system/env/environment0
-rwxr-xr-xunittest/pre/beluga/system/env/factory_init.json1
-rwxr-xr-xunittest/pre/beluga/system/release/beluga-release2
-rwxr-xr-xunittest/pre/beluga/system/tools/agent_config.sh64
-rwxr-xr-xunittest/pre/beluga/system/tools/agent_reset.sh31
-rwxr-xr-xunittest/pre/beluga/system/tools/availables-dockerd/dockerd_start-default.json4
-rwxr-xr-xunittest/pre/beluga/system/tools/dockerd_start.jsonbin0 -> 108 bytes
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-default.json10
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-headed-iiot.json10
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-headed.json10
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-headless-iiot.json10
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-headless.json10
-rwxr-xr-xunittest/pre/test_condition.sh6
24 files changed, 715 insertions, 0 deletions
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
new file mode 100755
index 0000000..70b0d3d
--- /dev/null
+++ b/unittest/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# 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.
+#
+# @file CMakeLists.txt
+# @author
+# @author
+# @brief Cmake for tests
+#
+
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/lib)
+
+SET(TARGET_GTEST_TESTS "gtest-docker-adaptor")
+
+FILE(GLOB TARGET_GTEST_TESTS_SRCS
+ *.cpp
+ ${CMAKE_SOURCE_DIR}/src/adaptor_setting.c
+ ${CMAKE_SOURCE_DIR}/src/input_file.c
+ ${CMAKE_SOURCE_DIR}/src/parse_file.c
+ ${CMAKE_SOURCE_DIR}/src/setup_system.c
+ ${CMAKE_SOURCE_DIR}/src/adaptor_util.c)
+
+INCLUDE(FindPkgConfig)
+
+IF(NONE_GBS_BUILD)
+ INCLUDE_DIRECTORIES(${LINK_LIB_INCLUDE})
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_EXE_LINKER_FLAGS ${LINK_FLAG})
+ELSE(NONE_GBS_BUILD)
+ pkg_check_modules(gtest_pkgs REQUIRED dlog json-c gmock)
+ENDIF(NONE_GBS_BUILD)
+
+INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})
+
+ADD_EXECUTABLE(${TARGET_GTEST_TESTS} ${TARGET_GTEST_TESTS_SRCS})
+
+TARGET_LINK_LIBRARIES(${TARGET_GTEST_TESTS} ${gtest_pkgs_LIBRARIES} gmock json-c pthread gcov --coverage)
+
+INSTALL(TARGETS ${TARGET_GTEST_TESTS} DESTINATION ${BIN_INSTALL_DIR})
diff --git a/unittest/beluga-adaptor_interface.cpp b/unittest/beluga-adaptor_interface.cpp
new file mode 100755
index 0000000..58c25fc
--- /dev/null
+++ b/unittest/beluga-adaptor_interface.cpp
@@ -0,0 +1,135 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "sa_common.h"
+#include "setup_system.h"
+#include "adaptor_interface.h"
+
+using ::testing::InitGoogleTest;
+
+TEST(beluga_adaptor_interface, beluga_adaptor_sa_get_os_info){
+ int ret = 0;
+ os_info_s *os_info_h = NULL;
+ char *buf = NULL;
+
+ _D("[UNIT_TEST] call sa_get_os_info~~~~~");
+ os_info_h = (os_info_s *)malloc(sizeof(os_info_s));
+ if (os_info_h != NULL) {
+ memset(os_info_h, 0x0, sizeof(os_info_s));
+ ret = sa_get_os_info(os_info_h);
+ if (ret != -1) {
+ // make json string
+ buf = sa_create_os_info_json_string(os_info_h);
+ //_D("json_str : %s", buf);
+ if (buf != NULL){
+ free(buf);
+ }
+ _D("[UNIT_TEST] os_info platformVer = %s",os_info_h->platformVer);
+ _D("[UNIT_TEST] os_info baseOS version = %s",os_info_h->baseOSVer);
+ _D("[UNIT_TEST] os_info docker version = %s",os_info_h->dockerVer);
+ }
+ if(os_info_h->platformVer)
+ free(os_info_h->platformVer);
+ if(os_info_h->baseOSVer)
+ free(os_info_h->baseOSVer);
+ if(os_info_h->dockerVer)
+ free(os_info_h->dockerVer);
+ free(os_info_h);
+ }
+ _D("[UNIT_TEST] os_info returned(%d) !!!!", ret);
+ EXPECT_EQ(0, ret);
+}
+
+TEST(beluga_adaptor_interface, beluga_adaptor_sa_get_disk_info){
+ int ret = 0;
+ disk_info_s *disk_info_h = NULL;
+ char *buf = NULL;
+ int index = 0;
+
+ _D("[UNIT_TEST] call sa_get_disk_info~~~~~");
+ disk_info_h = (disk_info_s *)malloc(sizeof(disk_info_s));
+ if (disk_info_h != NULL) {
+ memset(disk_info_h, 0x0, sizeof(disk_info_s));
+ ret = sa_get_disk_info(disk_info_h);
+ if (ret != -1) {
+ // make json string
+ buf = sa_create_disk_info_json_string(disk_info_h);
+ //_D("json_str : %s", buf);
+ if (buf != NULL) {
+ free(buf);
+ }
+ for (index = 0; index < disk_info_h->count; index++) {
+ _D("disk_info[%d] path = %s", index, disk_info_h->disk[index].path);
+ _D("disk_info[%d] free = %dM", index, disk_info_h->disk[index].free);
+ _D("disk_info[%d] total = %dM", index, disk_info_h->disk[index].total);
+ _D("disk_info[%d] used = %dM", index, disk_info_h->disk[index].used);
+ _D("disk_info[%d] usedpercent = %.2f%%", index, (float)disk_info_h->disk[index].usedpercent/(float)100);
+ }
+ }
+
+ for (index = 0; index < disk_info_h->count; index++) {
+ if(disk_info_h->disk[index].path)
+ free(disk_info_h->disk[index].path);
+ }
+ free(disk_info_h);
+ }
+ _D("[UNIT_TEST] os_info returned(%d) !!!!", ret);
+ EXPECT_EQ(0, ret);
+}
+
+TEST(beluga_adaptor_interface, beluga_adaptor_sa_create_device_reboot_json_string){
+ char *buf = NULL;
+ int ret = 0;
+
+ _D("[UNIT_TEST] sa_create_device_reboot_json_string()");
+ buf = sa_create_device_reboot_json_string(ret);
+
+ EXPECT_STRNE(NULL, buf);
+
+ if (buf != NULL)
+ {
+ free(buf);
+ }
+}
+
+/*
+TEST(beluga_adaptor_interface, beluga_adaptor_sa_factory_restore){
+ int ret = 0;
+ char *buf = NULL;
+ int buf_len = 0;
+ int fdevice_restart = 0;
+
+ _D("[UNIT_TEST] call sa_factory_restore~~~~~");
+ ret = sa_factory_restore(fdevice_restart);
+
+ buf = sa_create_factory_restore_json_string(ret);
+ if (buf != NULL) {
+ free(buf);
+ }
+ _D("[UNIT_TEST] os_info returned(%d) !!!!", ret);
+ EXPECT_EQ(0, ret);
+}
+
+TEST(beluga_adaptor_interface, beluga_adaptor_api_main_thread){
+
+ pthread_t t_api;
+ int ret = 0;
+
+ _D("[UNIT_TEST] pthread_create >>> API_MAIN !!!");
+ ret = pthread_create(&t_api, NULL, &api_main_thread, (void *)NULL);
+ if (ret < 0) {
+ _E("[UNIT_TEST][API_MAIN] thread create error (ret=%d)", ret);
+ ret = -1;
+ }
+ sleep(5);
+ pthread_cancel(t_api);
+
+ EXPECT_EQ(0, ret);
+}
+*/ \ No newline at end of file
diff --git a/unittest/beluga-adaptor_main.cpp b/unittest/beluga-adaptor_main.cpp
new file mode 100755
index 0000000..b74dff5
--- /dev/null
+++ b/unittest/beluga-adaptor_main.cpp
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+//#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+
+using ::testing::InitGoogleTest;
+
+int main(int argc, char **argv){
+ InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/unittest/beluga-adaptor_setting.cpp b/unittest/beluga-adaptor_setting.cpp
new file mode 100755
index 0000000..083d39a
--- /dev/null
+++ b/unittest/beluga-adaptor_setting.cpp
@@ -0,0 +1,145 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <pthread.h>
+
+#include "sa_common.h"
+#include "adaptor_api.h"
+#include "adaptor_setting.h"
+#include "setup_system.h"
+#include "adaptor_util.h"
+#include "parse_file.h"
+#include "json_util.h"
+
+
+using ::testing::InitGoogleTest;
+
+TEST(beluga_adaptor_setting, beluga_adaptor_setup_user_certificates){
+ int ret = 0;
+
+ _D("[UNIT_TEST] setup_user_certificates ~~~~~");
+
+ setup_user_certificates();
+
+ EXPECT_EQ(0, ret);
+}
+
+TEST(beluga_adaptor_setting, beluga_adaptor_sa_split_files){
+ sa_error_e ret = SA_ERROR_NONE;
+ char *orig_config_file = "/opt/beluga/setup-adaptor/config/config.json";
+ char sa_config_file_path[2][256] = {
+ "/opt/beluga/setup-adaptor/config/devconfig_system.json"
+ "/opt/beluga/setup-adaptor/config/devconfig_target.json"
+ };
+
+ _D("[UNIT_TEST] sa_split_files ~~~~~");
+
+ sa_split_files(orig_config_file, sa_config_file_path[0], sa_config_file_path[1]);
+
+ EXPECT_EQ(SA_ERROR_NONE, ret);
+}
+
+TEST(beluga_adaptor_setting, beluga_adaptor_sa_inputfile_get_config_info){
+ int flagInitialized = 0;
+ sa_error_e ret = SA_ERROR_NONE;
+ sa_config_s config = { 0, };
+ char *file_path = "/opt/beluga/setup-adaptor/config/config.json";
+
+ _D("[UNIT_TEST] sa_inputfile_get_config_info ~~~~~");
+
+ ret = sa_inputfile_get_config_info(&config, file_path);
+ sa_inputfile_release_resource(&config);
+
+ EXPECT_EQ(SA_ERROR_NONE, ret);
+}
+
+TEST(beluga_adaptor_setting, beluga_adaptor_sa_setup_system){
+ int flagInitialized = 0;
+ sa_error_e ret = SA_ERROR_NONE;
+ sa_config_s config = { 0, };
+ char *file_path = "/opt/beluga/setup-adaptor/config/config.json";
+
+ _D("[UNIT_TEST] sa_inputfile_get_config_info ~~~~~");
+
+ ret = sa_inputfile_get_config_info(&config, file_path);
+
+ if (ret == SA_ERROR_NONE) {
+ if (config.systemData != NULL)
+ {
+ ret = sa_setup_system(config.systemData, flagInitialized);
+ if (ret != SA_ERROR_NONE)
+ _E("sa_setup_system return error(%d)", ret);
+ _D("sa_setup_system() completed !!! ret(%d)", ret);
+ }
+ }
+ sa_inputfile_release_resource(&config);
+ _D("setup_cb completed <<<<<<<<<<<<<<<<<<<<<<<<");
+
+ EXPECT_EQ(SA_ERROR_NONE, ret);
+}
+
+TEST(beluga_adaptor_setting, beluga_adaptor_sa_remove_config_file){
+ sa_error_e ret = SA_ERROR_NONE;
+
+ _D("[UNIT_TEST] sa_remove_config_file ~~~~~");
+
+ ret = sa_remove_config_file();
+
+ EXPECT_EQ(SA_ERROR_NONE, ret);
+}
+
+TEST(beluga_adaptor_setting, beluga_adaptor_setting_main_thread){
+
+ pthread_t t_setting;
+ int ret = 0;
+ char cmd_gen_socket[128] = "sudo touch /var/run/beluga_launcher_notify.sock";
+
+ ret = CLI_command(cmd_gen_socket, 0, NULL);
+
+ _D("[UNIT_TEST] pthread_create >>> SETTING_MAIN !!!");
+ ret = pthread_create(&t_setting, NULL, &setting_main_thread, (void *)NULL);
+ if (ret < 0) {
+ _E("[UNIT_TEST][SETTING_MAIN] thread create error (ret=%d)", ret);
+ ret = -1;
+ }
+ sleep(5);
+ pthread_cancel(t_setting);
+
+ EXPECT_EQ(0, ret);
+}
+
+TEST(beluga_adaptor_setting, beluga_adaptor_setting_main_thread_compare_config_file){
+
+ pthread_t t_setting;
+ int ret = 0;
+ char cmd_gen_socket[128] = "sudo touch /var/run/beluga_launcher_notify.sock";
+ char cmd_copy_config_file[256] = "sudo cp /opt/beluga/setup-adaptor/config/devconfig_system.json /opt/beluga/setup-adaptor/config/devconfig_system_applied.json";
+
+ ret = CLI_command(cmd_gen_socket, 0, NULL);
+ ret = CLI_command(cmd_copy_config_file, 0, NULL);
+
+ _D("[UNIT_TEST] pthread_create >>> SETTING_MAIN !!!");
+ ret = pthread_create(&t_setting, NULL, &setting_main_thread, (void *)NULL);
+ if (ret < 0) {
+ _E("[UNIT_TEST][SETTING_MAIN] thread create error (ret=%d)", ret);
+ ret = -1;
+ }
+ sleep(5);
+ pthread_cancel(t_setting);
+
+ EXPECT_EQ(0, ret);
+}
+
+TEST(beluga_adaptor_setting, DISABLED_beluga_adaptor_send_message_to_launcher){
+
+ int ret = 0;
+
+ ret = send_message_to_launcher(SA_START_LAUNCHER_SVC);
+
+ EXPECT_EQ(0, ret);
+} \ No newline at end of file
diff --git a/unittest/pre/beluga/setup-adaptor/cert/SRnD+Web+Proxy.crt b/unittest/pre/beluga/setup-adaptor/cert/SRnD+Web+Proxy.crt
new file mode 100755
index 0000000..6d02635
--- /dev/null
+++ b/unittest/pre/beluga/setup-adaptor/cert/SRnD+Web+Proxy.crt
@@ -0,0 +1,25 @@
+-----BEGIN CERTIFICATE-----
+MIIEIzCCAwugAwIBAgIBADANBgkqhkiG9w0BAQUFADCBqzELMAkGA1UEBhMCa3Ix
+DjAMBgNVBAgMBVNlb3VsMRwwGgYDVQQKDBNTYW1zdW5nIEVsZWN0cm9uaWNzMRkw
+FwYDVQQDDBBTZW91bCBSJkQgQ2FtcHVzMRIwEAYDVQQHDAlTZW9jaG8tZ3UxGTAX
+BgNVBAsMEFNlb3VsIFImRCBDYW1wdXMxJDAiBgkqhkiG9w0BCQEWFXByb3h5LnNl
+bEBzYW1zdW5nLmNvbTAeFw0xNTEwMTQwODU5MDlaFw0zNTEwMTUwODU5MDlaMIGr
+MQswCQYDVQQGEwJrcjEOMAwGA1UECAwFU2VvdWwxHDAaBgNVBAoME1NhbXN1bmcg
+RWxlY3Ryb25pY3MxGTAXBgNVBAMMEFNlb3VsIFImRCBDYW1wdXMxEjAQBgNVBAcM
+CVNlb2Noby1ndTEZMBcGA1UECwwQU2VvdWwgUiZEIENhbXB1czEkMCIGCSqGSIb3
+DQEJARYVcHJveHkuc2VsQHNhbXN1bmcuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAvgEjYbjS/8XZHwu1Vdq0iDNbLNuzmFQb+GPdWYQlWqXOZb+K
+V0xrHqaYeThIdcmaMmJDsCpXeXGQn8kz54iNIrVB25ZfyLhVNjr+A1FUnbq2N9xL
+TH3fssovccghEuqT5TCMghjt2q2239SJ4AEFBQHkNvyrTzHy8itOD4AZiJZXIFNm
+HCpzO4oi88A/3AXZ7Y2FjVLSTfbcA0gH3Jaf/TLwOqwj4/2y6gbMt/OPerek/kDH
+AAWdGZCmJYwCtB+55Tl/iX8kelvJjVWMK9pZ9/naKW71ZkKmEXQ6O0arFP0HEYAR
+5kxCKUxlHzQRRpmTsSAi2ri9Dg41RgGsQystjQIDAQABo1AwTjAdBgNVHQ4EFgQU
+j9qoT6I0gGeg/93PMLb/OaGiRmMwHwYDVR0jBBgwFoAUj9qoT6I0gGeg/93PMLb/
+OaGiRmMwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAN3SatWdZXhJA
+7UIFoEqhiVMdKhzvu9nI3rIuAZzYMAtNsiSWqNgxC2JL/cS2YayjzXMuiJwPVDvs
+6uyb02AmBj25ztA2Y1BHLBbEDhqdiuUUzxdELx0wWwZqU+ovD/jNz51OuL72mh4b
+LxoUFQ+pmdtRUdqr0UGyC+28y3jw1DsvAQZBFWTS2AOxq57KpHBkOUcg1AT9xrYF
+8FCKeSJwgt65GqYbSxmG3s5PXIp0pmQgDFbAdWc+ioQeR45eDUL4wY+k2xZTPrZO
+vSsa1G1vxjAuzMthR4NvKi+vnTOLY1O8KvZ4oNhLbJoJvx/5zLvAll4pHR7ylu4g
+phRAhQcRxA==
+-----END CERTIFICATE----- \ No newline at end of file
diff --git a/unittest/pre/beluga/setup-adaptor/config/config.json b/unittest/pre/beluga/setup-adaptor/config/config.json
new file mode 100755
index 0000000..41bf33b
--- /dev/null
+++ b/unittest/pre/beluga/setup-adaptor/config/config.json
@@ -0,0 +1 @@
+{"wifi":{"ssid":"iot_kt","password":"iot1234!","enabled":false,"dhcpEnabled":true,"ipAddress":"127.0.0.1","netmask":"127.0.0.1","defaultGateway":"127.0.0.1","primaryDNSServer":"127.0.0.1"},"ethernet":{"enabled":true,"dhcpEnabled":false,"ipAddress":"10.113.64.123","netmask":"255.255.255.0","defaultGateway":"10.113.64.1","primaryDnsServer":"10.32.192.11"},"httpProxy":"10.112.1.184:8080","httpsProxy":"","deviceName":"artik530","insecureRegistries":["10.113.80.72:443","52.78.68.250:5000","docker.sec.samsung.net:5000"]} \ No newline at end of file
diff --git a/unittest/pre/beluga/setup-adaptor/config/set_eth_config.sh b/unittest/pre/beluga/setup-adaptor/config/set_eth_config.sh
new file mode 100755
index 0000000..c3f7778
--- /dev/null
+++ b/unittest/pre/beluga/setup-adaptor/config/set_eth_config.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+file="/var/lib/connman/ethernet.config"
+service_name="service_home_ethernet"
+
+
+create_file()
+{
+ if [ -f "$file" ] ; then
+ echo "remove existing file"
+ rm "$file"
+ fi
+ touch "$file"
+}
+
+add_ip_address()
+{
+ if [ -n "$IP" ] && [ -n "$NETMASK" ] && [ -n "$GATEWAY" ]; then
+ ipv4="$IP"/"$NETMASK"/"$GATEWAY"
+ else
+ echo -e "\nenter [ipAddress] [netmask] [gateway]"
+ ipv4=""
+ fi
+
+ if [ -n "$ipv4" ]; then
+ echo "IPv4 = ${ipv4}" >> "$file"
+ echo -e "SET ==>> IPv4 = ${ipv4}"
+ else
+ rm "$file"
+ echo -e "file write error"
+ exit 1
+ fi
+}
+
+add_dns_server()
+{
+ if [ -n "$DNS1" ] && [ -n "$DNS2" ]; then
+ dns_server="$DNS1","$DNS2"
+ elif [ -n "$DNS1" ] && [ -z "$DNS2" ]; then
+ dns_server="$DNS1"
+ else
+ dns_server=""
+ fi
+
+ if [ -n "$dns_server" ]; then
+ echo "Nameservers = ${dns_server}" >> "$file"
+ echo "SET ==>> Nameservers = ${dns_server}"
+ fi
+}
+
+#start to write config file
+echo "create config file ${file}"
+create_file
+
+echo "[${service_name}]" >> "$file"
+echo "Type = ethernet" >> "$file"
+
+add_ip_address
+add_dns_server
+
+#change file mode
+chmod +x "$file"
+echo -e "complete to write...\n"
+
+
+#disable ethernet service
+connmanctl disable ethernet
+
+#enable ethernet service
+connmanctl enable ethernet
+
+cat ${file}
diff --git a/unittest/pre/beluga/setup-adaptor/config/set_wifi_config.sh b/unittest/pre/beluga/setup-adaptor/config/set_wifi_config.sh
new file mode 100755
index 0000000..8e3aab6
--- /dev/null
+++ b/unittest/pre/beluga/setup-adaptor/config/set_wifi_config.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+file="/var/lib/connman/wifi.config"
+service_name="service_home_wifi"
+
+
+create_file()
+{
+ if [ -f "$file" ] ; then
+ echo "remove existing file"
+ rm "$file"
+ fi
+ touch "$file"
+}
+
+add_ssid_pw()
+{
+ echo "Name = ${SSID}" >> "$file"
+ echo "Passphrase = ${PASSWORD}" >> "$file"
+
+ echo -e "SET ==>> Name = ${SSID}"
+ echo -e "SET ==>> Passphrase = ${PASSWORD}"
+}
+
+add_ip_address()
+{
+ if [ -n "$IP" ] && [ -n "$NETMASK" ] && [ -n "$GATEWAY" ]; then
+ ipv4="$IP"/"$NETMASK"/"$GATEWAY"
+ elif [ -n "$DHCP" ]; then
+ ipv4="dhcp"
+ else
+ ipv4=""
+ fi
+
+ if [ -n "$ipv4" ]; then
+ echo "IPv4 = ${ipv4}" >> "$file"
+ echo -e "SET ==>> IPv4 = ${ipv4}"
+ fi
+}
+
+add_dns_server()
+{
+ if [ -n "$DNS1" ] && [ -n "$DNS2" ]; then
+ dns_server="$DNS1","$DNS2"
+ elif [ -n "$DNS1" ] && [ -z "$DNS2" ]; then
+ dns_server="$DNS1"
+ else
+ dns_server=""
+ fi
+
+ if [ -n "$dns_server" ]; then
+ echo "Nameservers = ${dns_server}" >> "$file"
+ echo "SET ==>> Nameservers = ${dns_server}"
+ fi
+}
+
+
+#start to write config file
+echo "create config file ${file}"
+create_file
+
+echo "[${service_name}]" >> "$file"
+echo "Type = wifi" >> "$file"
+
+add_ssid_pw
+add_ip_address
+add_dns_server
+
+#change file mode
+chmod +x "$file"
+echo -e "complete to write...\n"
+
+#disable wifi service
+connmanctl disable wifi
+
+#enable wifi service
+connmanctl enable wifi
+
+cat ${file}
diff --git a/unittest/pre/beluga/setup-adaptor/container/config-agent.yml b/unittest/pre/beluga/setup-adaptor/container/config-agent.yml
new file mode 100755
index 0000000..08a746c
--- /dev/null
+++ b/unittest/pre/beluga/setup-adaptor/container/config-agent.yml
@@ -0,0 +1,15 @@
+## agent containers spec
+version: '2'
+services:
+ beluga-agent:
+ image: docker.sec.samsung.net:5000/beluga/armhf/beluga-agent:v0.5.3
+ ports:
+ - "9090:9090"
+ container_name: beluga-agent
+ volumes:
+ - /var/run:/var/run:ro
+ - /etc/dockzen/sc:/data/ip:rw
+ - /opt/beluga/setup-adaptor:/target:rw
+ net_mode: bridge
+ privileged: true
+ enable: true
diff --git a/unittest/pre/beluga/setup-adaptor/container/config-service.yml b/unittest/pre/beluga/setup-adaptor/container/config-service.yml
new file mode 100755
index 0000000..b11129d
--- /dev/null
+++ b/unittest/pre/beluga/setup-adaptor/container/config-service.yml
@@ -0,0 +1,14 @@
+## app containers spec
+version: '2'
+services:
+ pharos-node:
+ image: docker.sec.samsung.net:5000/edge/system-pharos-node-go/rpi_arm:latest
+ ports:
+ - "48098:48098"
+ container_name: pharos-node
+ environment:
+ - ANCHOR_ADDRESS=10.113.80.65
+ - NODE_ADDRESS=10.113.80.66
+ volumes:
+ - /opt/beluga/uc:/data/db
+ - /var/run/docker.sock:/var/run/docker.sock
diff --git a/unittest/pre/beluga/system/docker/dockerd_start.json b/unittest/pre/beluga/system/docker/dockerd_start.json
new file mode 100755
index 0000000..8879151
--- /dev/null
+++ b/unittest/pre/beluga/system/docker/dockerd_start.json
@@ -0,0 +1,6 @@
+{
+"opt_cmd" : "-s overlay2 --data-root=/opt/beluga/var/lib/docker --userland-proxy=false -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375"
+}
+
+
+
diff --git a/unittest/pre/beluga/system/env/environment b/unittest/pre/beluga/system/env/environment
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/unittest/pre/beluga/system/env/environment
diff --git a/unittest/pre/beluga/system/env/factory_init.json b/unittest/pre/beluga/system/env/factory_init.json
new file mode 100755
index 0000000..c27e836
--- /dev/null
+++ b/unittest/pre/beluga/system/env/factory_init.json
@@ -0,0 +1 @@
+{ "worked": 0 } \ No newline at end of file
diff --git a/unittest/pre/beluga/system/release/beluga-release b/unittest/pre/beluga/system/release/beluga-release
new file mode 100755
index 0000000..b4d8fea
--- /dev/null
+++ b/unittest/pre/beluga/system/release/beluga-release
@@ -0,0 +1,2 @@
+VERSION="Beluga 1.0.0"
+BUILD_DATE=20180711
diff --git a/unittest/pre/beluga/system/tools/agent_config.sh b/unittest/pre/beluga/system/tools/agent_config.sh
new file mode 100755
index 0000000..c449941
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/agent_config.sh
@@ -0,0 +1,64 @@
+#! /bin/sh
+#set -e
+
+WORK_DIR=/etc/dockzen/sc
+AGENT_JSON=$WORK_DIR/dockzen_agent.json
+INIT_JSON=$WORK_DIR/factory_init.json
+
+stop() {
+ echo "Stop docker service of dockzen-agent"
+ if [ ! -z "$(docker service ls -q)" ]; then
+ docker service rm $(docker service ls -q)
+ fi
+ docker system prune -f
+ echo "Stop dockzen-launcher.service"
+ systemctl status dockzen-launcher.service | grep Active
+ systemctl stop dockzen-launcher.service
+ systemctl status dockzen-launcher.service | grep Active
+ echo "Change symbolic link of dockzen_agent.json"
+ rm $AGENT_JSON
+ echo "Clear init flag"
+ rm $INIT_JSON
+ echo "Start dockzen-launcher.service"
+ systemctl start dockzen-launcher.service
+ echo "Done"
+}
+
+restart() {
+ echo "Start dockzen-launcher.service"
+ systemctl start dockzen-launcher.service
+}
+
+if [ "$1" == "noop" ]; then
+ echo "---------------------------------------------------"
+ echo " clear agent as no-operation"
+ echo "---------------------------------------------------"
+ stop
+ restart
+ echo "Cleared !!!"
+elif [ "$1" == "show" ]; then
+ echo "---------------------------------------------------"
+ echo " show current agent"
+ echo "---------------------------------------------------"
+ if [ -f "$AGENT_JSON" ]; then
+ readlink $AGENT_JSON
+ else
+ echo "empty file ($AGENT_JSON)"
+ fi
+ echo "Completed !!!"
+elif [ -f "$1" ]; then
+ echo "---------------------------------------------------"
+ echo " change agent target"
+ echo "---------------------------------------------------"
+ stop
+ echo "Change symbolic link of dockzen_agent.json(-->$1)"
+ ln -s $1 $AGENT_JSON
+ restart
+ echo "Done !!! linked to \"$(readlink $AGENT_JSON)\""
+else
+ echo "check input parameter"
+ echo "Usage 1 : ./agent_set noop (disable agent)"
+ echo "Usage 2 : ./agent_set show (display current agent config file)"
+ echo "Usage 3 : ./agent_set [json file] (set agent config file)"
+fi
+ \ No newline at end of file
diff --git a/unittest/pre/beluga/system/tools/agent_reset.sh b/unittest/pre/beluga/system/tools/agent_reset.sh
new file mode 100755
index 0000000..795b0e5
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/agent_reset.sh
@@ -0,0 +1,31 @@
+#! /bin/bash
+#set -e
+
+echo "Stop docker services"
+if [ ! -z "$(docker service ls -q)" ]; then
+ docker service rm $(docker service ls -q)
+fi
+
+echo "Remove container lists"
+if [ ! -z "$(docker ps -a -q)" ]; then
+ docker rm $(docker ps -a -q) -f
+fi
+
+echo "Remove image lists"
+if [ ! -z "$(docker images -q)" ]; then
+ docker rmi $(docker images -q) -f
+fi
+
+echo "Do prune"
+docker system prune -f
+
+echo "Stop dockzen-launcher.service"
+systemctl stop dockzen-launcher.service
+
+echo "Delete /var/lib/docker folder"
+rm /var/lib/docker/ -rf
+
+echo "Clear init flag"
+rm /etc/dockzen/sc/factory_init.json
+
+reboot -f \ No newline at end of file
diff --git a/unittest/pre/beluga/system/tools/availables-dockerd/dockerd_start-default.json b/unittest/pre/beluga/system/tools/availables-dockerd/dockerd_start-default.json
new file mode 100755
index 0000000..6b7bc0d
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/availables-dockerd/dockerd_start-default.json
@@ -0,0 +1,4 @@
+{
+"opt_cmd" : "-s overlay2 --data-root=/opt/beluga/var/lib/docker --userland-proxy=false -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375"
+}
+
diff --git a/unittest/pre/beluga/system/tools/dockerd_start.json b/unittest/pre/beluga/system/tools/dockerd_start.json
new file mode 100755
index 0000000..8d0715e
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/dockerd_start.json
Binary files differ
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-default.json b/unittest/pre/beluga/system/tools/dockzen_agent-default.json
new file mode 100755
index 0000000..8ff75ac
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/dockzen_agent-default.json
@@ -0,0 +1,10 @@
+{
+"name" : "dockzen-agent",
+"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.2",
+"volume" : "/var/run:/var/run:rw,/etc/dockzen/sc:/data/ip:rw",
+"port" : "9090:9090",
+"net_mode" : "bridge",
+"privileged" : false,
+"enable" : true
+}
+
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-headed-iiot.json b/unittest/pre/beluga/system/tools/dockzen_agent-headed-iiot.json
new file mode 100755
index 0000000..569b631
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/dockzen_agent-headed-iiot.json
@@ -0,0 +1,10 @@
+{
+"name" : "dockzen-agent",
+"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.0-headed-iiot",
+"volume" : "/var/run:/var/run:rw,/etc/dockzen/sc:/data/ip:rw",
+"port" : "9090:9090",
+"net_mode" : "bridge",
+"privileged" : false,
+"enable" : true
+}
+
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-headed.json b/unittest/pre/beluga/system/tools/dockzen_agent-headed.json
new file mode 100755
index 0000000..56d8aee
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/dockzen_agent-headed.json
@@ -0,0 +1,10 @@
+{
+"name" : "dockzen-agent",
+"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.0-headed",
+"volume" : "/var/run:/var/run:rw,/etc/dockzen/sc:/data/ip:rw",
+"port" : "9090:9090",
+"net_mode" : "bridge",
+"privileged" : false,
+"enable" : true
+}
+
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-headless-iiot.json b/unittest/pre/beluga/system/tools/dockzen_agent-headless-iiot.json
new file mode 100755
index 0000000..f839c86
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/dockzen_agent-headless-iiot.json
@@ -0,0 +1,10 @@
+{
+"name" : "dockzen-agent",
+"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.0-headless-iiot",
+"volume" : "/var/run:/var/run:rw",
+"port" : "9090:9090",
+"net_mode" : "bridge",
+"privileged" : false,
+"enable" : true
+}
+
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-headless.json b/unittest/pre/beluga/system/tools/dockzen_agent-headless.json
new file mode 100755
index 0000000..3179a8d
--- /dev/null
+++ b/unittest/pre/beluga/system/tools/dockzen_agent-headless.json
@@ -0,0 +1,10 @@
+{
+"name" : "dockzen-agent",
+"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.0-headless",
+"volume" : "/var/run:/var/run:rw",
+"port" : "9090:9090",
+"net_mode" : "bridge",
+"privileged" : false,
+"enable" : true
+}
+
diff --git a/unittest/pre/test_condition.sh b/unittest/pre/test_condition.sh
new file mode 100755
index 0000000..362c093
--- /dev/null
+++ b/unittest/pre/test_condition.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+set -e
+
+echo "copy beluga working files"
+sudo cp -rf ./unittest/pre/beluga/ /opt/ \ No newline at end of file