# HG changeset patch # User Edouard Tisserant # Date 1675280615 -3600 # Node ID 7841b651d601342c8f344c3a8d09a0e4c87464bd # Parent da9ffd57255139c0b92da13d2069b441715b6a06 Tests: OPCUA tests can now use OPCUA_DEFAULT_HOST environment variable to force host to something else than "127.0.0.1" or "localhost" diff -r da9ffd572551 -r 7841b651d601 opc_ua/client.py --- a/opc_ua/client.py Mon Jan 16 16:22:44 2023 +0100 +++ b/opc_ua/client.py Wed Feb 01 20:43:35 2023 +0100 @@ -22,6 +22,9 @@ ("include",), ("arch",)]] +# Tests need to use other default hosts +OPCUA_DEFAULT_HOST = os.environ.get("OPCUA_DEFAULT_HOST", "127.0.0.1") + class OPCUAClientEditor(ConfTreeNodeEditor): CONFNODEEDITOR_TABS = [ (_("OPC-UA Client"), "CreateOPCUAClient_UI")] @@ -79,7 +82,7 @@ - + diff -r da9ffd572551 -r 7841b651d601 tests/cli_tests/opcua_test.bash --- a/tests/cli_tests/opcua_test.bash Mon Jan 16 16:22:44 2023 +0100 +++ b/tests/cli_tests/opcua_test.bash Wed Feb 01 20:43:35 2023 +0100 @@ -17,12 +17,15 @@ ) << EOF & import sys +import os import time from opcua import ua, Server server = Server() -server.set_endpoint("opc.tcp://127.0.0.1:4840/freeopcua/server/") +host = os.environ.get("OPCUA_DEFAULT_HOST", "127.0.0.1") +endpoint = "opc.tcp://"+host+":4840/freeopcua/server/" +server.set_endpoint(endpoint) uri = "http://beremiz.github.io" idx = server.register_namespace(uri) diff -r da9ffd572551 -r 7841b651d601 tests/cli_tests/opcua_test_encrypted.bash --- a/tests/cli_tests/opcua_test_encrypted.bash Mon Jan 16 16:22:44 2023 +0100 +++ b/tests/cli_tests/opcua_test_encrypted.bash Wed Feb 01 20:43:35 2023 +0100 @@ -22,12 +22,15 @@ ) << EOF & import sys +import os import time from opcua import ua, Server server = Server() -server.set_endpoint("opc.tcp://127.0.0.1:4840/freeopcua/server/") +host = os.environ.get("OPCUA_DEFAULT_HOST", "127.0.0.1") +endpoint = "opc.tcp://"+host+":4840/freeopcua/server/" +server.set_endpoint(endpoint) server.set_security_policy([ua.SecurityPolicyType.Basic256Sha256_SignAndEncrypt]) server.load_certificate("my_cert.der") diff -r da9ffd572551 -r 7841b651d601 tests/ide_tests/opcua_browse.sikuli/opcua_service.bash --- a/tests/ide_tests/opcua_browse.sikuli/opcua_service.bash Mon Jan 16 16:22:44 2023 +0100 +++ b/tests/ide_tests/opcua_browse.sikuli/opcua_service.bash Wed Feb 01 20:43:35 2023 +0100 @@ -6,12 +6,15 @@ exec $BEREMIZPYTHONPATH - << EOF import sys +import os import time from opcua import ua, Server server = Server() -server.set_endpoint("opc.tcp://127.0.0.1:4840/freeopcua/server/") +host = os.environ.get("OPCUA_DEFAULT_HOST", "127.0.0.1") +endpoint = "opc.tcp://"+host+":4840/freeopcua/server/" +server.set_endpoint(endpoint) uri = "http://beremiz.github.io" idx = server.register_namespace(uri) diff -r da9ffd572551 -r 7841b651d601 tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_service.bash --- a/tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_service.bash Mon Jan 16 16:22:44 2023 +0100 +++ b/tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_service.bash Wed Feb 01 20:43:35 2023 +0100 @@ -16,12 +16,15 @@ exec $BEREMIZPYTHONPATH - << EOF import sys +import os import time from opcua import ua, Server server = Server() -server.set_endpoint("opc.tcp://127.0.0.1:4840/freeopcua/server/") +host = os.environ.get("OPCUA_DEFAULT_HOST", "127.0.0.1") +endpoint = "opc.tcp://"+host+":4840/freeopcua/server/" +server.set_endpoint(endpoint) server.set_security_policy([ua.SecurityPolicyType.Basic256Sha256_SignAndEncrypt]) server.load_certificate("my_cert.der")