<commit_before>#!/bin/bash
#
# CODENVY CONFIDENTIAL
# ________________
#
# [2012] - [2015] Codenvy, S.A.
# All Rights Reserved.
# NOTICE: All information contained herein is, and remains
# the property of Codenvy S.A. and its suppliers,
# if any. The intellectual and technical concepts contained
# herein are proprietary to Codenvy S.A.
# and its suppliers and may be covered by U.S. and Foreign Patents,
# patents in process, and are protected by trade secret or copyright law.
# Dissemination of this information or reproduction of this material
# is strictly forbidden unless prior written permission is obtained
# from Codenvy S.A..
#

[ -f "./lib.sh" ] && . ./lib.sh
[ -f "../lib.sh" ] && . ../lib.sh

printAndLog "TEST CASE: Setup and update Codenvy 4.x On Premise configuration"

vagrantUp ${SINGLE_NODE_VAGRANT_FILE}

installCodenvy ${LATEST_CODENVY4_VERSION} --config=${CUSTOM_SINGLE_NODE_PREVIOUS_VERSION_CONFIG_URL}
validateInstalledCodenvyVersion ${LATEST_CODENVY4_VERSION}

PROPERTY_TO_TEST=zabbix_admin_email
VALUE_TO_TEST=root@localhost
VALUE_TO_UPDATE=user@localhost

executeIMCommand "config"
validateExpectedString ".*admin_ldap_password=*****.*installation_manager_update_server_endpoint=$UPDATE_SERVICE.*version=$LATEST_CODENVY4_VERSION.*$PROPERTY_TO_TEST=$VALUE_TO_TEST.*"

executeIMCommand "config $PROPERTY_TO_TEST"
validateExpectedString ".*$PROPERTY_TO_TEST=$VALUE_TO_TEST.*"

executeSshCommand "echo y | codenvy config $PROPERTY_TO_TEST $VALUE_TO_UPDATE"
validateExpectedString ".*$PROPERTY_TO_TEST=$VALUE_TO_UPDATE.*"

executeIMCommand "config $PROPERTY_TO_TEST"
validateExpectedString ".*$PROPERTY_TO_TEST=$VALUE_TO_UPDATE.*"

## validate using custom config file
PATH_TO_CUSTOM_CONFIG="codenvy.properties.${LATEST_CODENVY4_VERSION}"
executeSshCommand "cp codenvy.properties $PATH_TO_CUSTOM_CONFIG"

installCodenvy --valid-exit-code=1 ${LATEST_CODENVY4_VERSION}
executeSshCommand "cat codenvy.properties | grep ${LATEST_CODENVY4_VERSION}"
executeSshCommand --valid-exit-code=1 "test -f codenvy.properties.back"

# custom config file defined by url
installCodenvy --valid-exit-code=1 ${LATEST_CODENVY4_VERSION} --config=${CUSTOM_SINGLE_NODE_PREV_VERSION_CONFIG_URL}
executeSshCommand "cat codenvy.properties | grep ${PREV_CODENVY4_VERSION}"
executeSshCommand "cat codenvy.properties.back | grep ${LATEST_CODENVY4_VERSION}"

# custom config file defined by path
installCodenvy --valid-exit-code=1 ${LATEST_CODENVY4_VERSION} --config=${PATH_TO_CUSTOM_CONFIG}
executeSshCommand "cat codenvy.properties | grep ${LATEST_CODENVY4_VERSION}"
executeSshCommand "cat codenvy.properties.back | grep ${PREV_CODENVY4_VERSION}"

installCodenvy --valid-exit-code=1 ${PREV_CODENVY4_VERSION}
executeSshCommand "cat codenvy.properties | grep ${PREV_CODENVY4_VERSION}"
executeSshCommand "cat codenvy.properties.back | grep ${LATEST_CODENVY4_VERSION}"

printAndLog "RESULT: PASSED"

vagrantDestroy<commit_msg>Fix IM test of update single node with Codenvy 4<commit_after>#!/bin/bash
#
# CODENVY CONFIDENTIAL
# ________________
#
# [2012] - [2015] Codenvy, S.A.
# All Rights Reserved.
# NOTICE: All information contained herein is, and remains
# the property of Codenvy S.A. and its suppliers,
# if any. The intellectual and technical concepts contained
# herein are proprietary to Codenvy S.A.
# and its suppliers and may be covered by U.S. and Foreign Patents,
# patents in process, and are protected by trade secret or copyright law.
# Dissemination of this information or reproduction of this material
# is strictly forbidden unless prior written permission is obtained
# from Codenvy S.A..
#

[ -f "./lib.sh" ] && . ./lib.sh
[ -f "../lib.sh" ] && . ../lib.sh

printAndLog "TEST CASE: Setup and update Codenvy 4.x On Premise configuration"

vagrantUp ${SINGLE_NODE_VAGRANT_FILE}

installCodenvy ${LATEST_CODENVY4_VERSION} --config=${CUSTOM_SINGLE_NODE_LATEST_VERSION_CONFIG_URL}
validateInstalledCodenvyVersion ${LATEST_CODENVY4_VERSION}

PROPERTY_TO_TEST=zabbix_admin_email
VALUE_TO_TEST=root@localhost
VALUE_TO_UPDATE=user@localhost

executeIMCommand "config"
validateExpectedString ".*admin_ldap_password=*****.*installation_manager_update_server_endpoint=$UPDATE_SERVICE.*version=$LATEST_CODENVY4_VERSION.*$PROPERTY_TO_TEST=$VALUE_TO_TEST.*"

executeIMCommand "config $PROPERTY_TO_TEST"
validateExpectedString ".*$PROPERTY_TO_TEST=$VALUE_TO_TEST.*"

executeSshCommand "echo y | codenvy config $PROPERTY_TO_TEST $VALUE_TO_UPDATE"
validateExpectedString ".*$PROPERTY_TO_TEST=$VALUE_TO_UPDATE.*"

executeIMCommand "config $PROPERTY_TO_TEST"
validateExpectedString ".*$PROPERTY_TO_TEST=$VALUE_TO_UPDATE.*"

# validate using custom config file
PATH_TO_INSTALL_DIR=codenvy
PATH_TO_CUSTOM_CONFIG="${PATH_TO_INSTALL_DIR}/codenvy.properties.${LATEST_CODENVY4_VERSION}"
executeSshCommand "mv ${PATH_TO_INSTALL_DIR}/codenvy.properties $PATH_TO_CUSTOM_CONFIG"

installCodenvy --valid-exit-code=1 ${LATEST_CODENVY4_VERSION}
executeSshCommand "cat ${PATH_TO_INSTALL_DIR}/codenvy.properties | grep ${LATEST_CODENVY4_VERSION}"
executeSshCommand --valid-exit-code=1 "test -f ${PATH_TO_INSTALL_DIR}/codenvy.properties.back"

# custom config file defined by url
installCodenvy --valid-exit-code=1 ${PREV_CODENVY4_VERSION} --config=${CUSTOM_SINGLE_NODE_PREV_VERSION_CONFIG_URL}
executeSshCommand "cat ${PATH_TO_INSTALL_DIR}/codenvy.properties | grep ${PREV_CODENVY4_VERSION}"
executeSshCommand "cat ${PATH_TO_INSTALL_DIR}/codenvy.properties.back | grep ${LATEST_CODENVY4_VERSION}"

# custom config file defined by path
installCodenvy --valid-exit-code=1 ${LATEST_CODENVY4_VERSION} --config=${PATH_TO_CUSTOM_CONFIG}
executeSshCommand "cat ${PATH_TO_INSTALL_DIR}/codenvy.properties | grep ${LATEST_CODENVY4_VERSION}"
executeSshCommand "cat ${PATH_TO_INSTALL_DIR}/codenvy.properties.back | grep ${PREV_CODENVY4_VERSION}"

installCodenvy --valid-exit-code=1 ${PREV_CODENVY4_VERSION}
executeSshCommand "cat ${PATH_TO_INSTALL_DIR}/codenvy.properties | grep ${PREV_CODENVY4_VERSION}"
executeSshCommand "cat ${PATH_TO_INSTALL_DIR}/codenvy.properties.back | grep ${LATEST_CODENVY4_VERSION}"

printAndLog "RESULT: PASSED"

vagrantDestroy
{'fraction_non_alphanumeric': 0.10192747468147664, 'fraction_numerical': 0.009637373407383208, 'mean_word_length': 7.353342428376535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7665979', 'n_tokens_mistral': 2158, 'n_tokens_neox': 2093, 'n_words': 439}