Skip to content

Commit 745b6de

Browse files
serrislewSerris Lew
andauthored
Run autests with curl UDS default (#12168)
* Run autests with curl UDS default * Conditionalize bigobj & copy_config autests * set uds_path in ts runtime dir, not test runtime dir * Add ts runtimedir path, update existing autest for uds case instead of adding new autest * syntax error * Update curl command from uds_path to ts arg --------- Co-authored-by: Serris Lew <lserris@apple.com>
1 parent 671f791 commit 745b6de

File tree

175 files changed

+1699
-692
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+1699
-692
lines changed

CMakePresets.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@
6363
"ENABLE_EXAMPLE": "ON"
6464
}
6565
},
66+
{
67+
"name": "autest-uds",
68+
"inherits": ["default"],
69+
"binaryDir": "${sourceDir}/build-autest",
70+
"cacheVariables": {
71+
"ENABLE_AUTEST": "ON",
72+
"ENABLE_AUTEST_UDS": "ON",
73+
"CMAKE_INSTALL_PREFIX": "/tmp/ts-autest",
74+
"BUILD_EXPERIMENTAL_PLUGINS": "ON",
75+
"ENABLE_EXAMPLE": "ON"
76+
}
77+
},
6678
{
6779
"name": "dev",
6880
"displayName": "development",

tests/CMakeLists.txt

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,53 @@ function(ADD_AUTEST_PLUGIN _NAME)
3636
endfunction()
3737

3838
add_subdirectory(tools/plugins)
39-
add_subdirectory(gold_tests/chunked_encoding)
40-
add_subdirectory(gold_tests/continuations/plugins)
41-
add_subdirectory(gold_tests/jsonrpc/plugins)
42-
add_subdirectory(gold_tests/pluginTest/polite_hook_wait)
43-
add_subdirectory(gold_tests/pluginTest/tsapi)
44-
add_subdirectory(gold_tests/pluginTest/TSVConnFd)
45-
add_subdirectory(gold_tests/timeout)
46-
add_subdirectory(gold_tests/tls)
47-
4839
set(RUNPIPENV PIPENV_VENV_IN_PROJECT=True ${PipEnv})
4940

50-
configure_file(Pipfile Pipfile COPYONLY)
51-
configure_file(autest.sh.in autest.sh)
52-
41+
set(CMAKE_GOLD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gold_tests_filtered")
5342
set(CURL_UDS_FLAG "")
5443
if(ENABLE_AUTEST_UDS)
5544
set(CURL_UDS_FLAG "--curl-uds")
45+
# Copy everything except dirs: h2, tls
46+
# Other specific tests will be skipped
47+
file(
48+
COPY ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests/
49+
DESTINATION ${CMAKE_GOLD_DIR}
50+
FILES_MATCHING
51+
PATTERN "*"
52+
PATTERN "h2" EXCLUDE
53+
PATTERN "tls*" EXCLUDE
54+
PATTERN "tls/ssl/**"
55+
)
56+
else()
57+
# Copy everything except autest_uds tests that are only for curl uds option
58+
file(
59+
COPY ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests/
60+
DESTINATION ${CMAKE_GOLD_DIR}
61+
FILES_MATCHING
62+
PATTERN "*"
63+
)
64+
add_subdirectory(gold_tests_filtered/tls)
5665
endif()
5766

67+
add_subdirectory(gold_tests_filtered/chunked_encoding)
68+
add_subdirectory(gold_tests_filtered/continuations/plugins)
69+
add_subdirectory(gold_tests_filtered/jsonrpc/plugins)
70+
add_subdirectory(gold_tests_filtered/pluginTest/polite_hook_wait)
71+
add_subdirectory(gold_tests_filtered/pluginTest/tsapi)
72+
add_subdirectory(gold_tests_filtered/pluginTest/TSVConnFd)
73+
add_subdirectory(gold_tests_filtered/timeout)
74+
75+
configure_file(Pipfile Pipfile COPYONLY)
76+
configure_file(autest.sh.in autest.sh)
77+
5878
add_custom_target(
5979
autest
6080
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target install
6181
COMMAND ${RUNPIPENV} install
6282
COMMAND
63-
${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/gold_tests/remap:$ENV{PYTHONPATH} ${RUNPIPENV} run
64-
env autest --directory ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests --ats-bin=${CMAKE_INSTALL_PREFIX}/bin
65-
--proxy-verifier-bin ${PROXY_VERIFIER_PATH} --build-root ${CMAKE_BINARY_DIR} --sandbox ${AUTEST_SANDBOX}
66-
${CURL_UDS_FLAG} ${AUTEST_OPTIONS}
83+
${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_GOLD_DIR}/remap:$ENV{PYTHONPATH} ${RUNPIPENV} run env autest --directory
84+
${CMAKE_GOLD_DIR} --ats-bin=${CMAKE_INSTALL_PREFIX}/bin --proxy-verifier-bin ${PROXY_VERIFIER_PATH} --build-root
85+
${CMAKE_BINARY_DIR} --sandbox ${AUTEST_SANDBOX} ${CURL_UDS_FLAG} ${AUTEST_OPTIONS}
6786
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
6887
USES_TERMINAL
6988
)

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ ts=Test.MakeATSProcess("ts")
132132
#first test is a miss for default
133133
tr=Test.AddTestRun()
134134
# get port for command from Variables
135-
tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port))
135+
tr.MakeCurlCommand('"http://127.0.0.1:{0}" --verbose'.format(ts.Variables.port), ts=ts)
136136

137137
```
138138

tests/autest.sh.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/gold_tests/remap:$PYTHONPATH
99

1010
${RUNPIPENV} run env autest \
1111
--sandbox ${AUTEST_SANDBOX} \
12-
--directory ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests \
12+
--directory ${CMAKE_GOLD_DIR} \
1313
--ats-bin=${CMAKE_INSTALL_PREFIX}/bin \
1414
--proxy-verifier-bin ${PROXY_VERIFIER_PATH} \
1515
--build-root ${CMAKE_BINARY_DIR} \

tests/gold_tests/autest-site/conditions.test.ext

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ def PluginExists(self, pluginname):
110110
return self.Condition(lambda: os.path.isfile(path), path + " not found.")
111111

112112

113+
def CurlUsingUnixDomainSocket(self):
114+
return self.Condition(lambda: self.Variables.get("CurlUds", False), "Curl using UDS. Not relevant for test")
115+
116+
113117
ExtendCondition(HasOpenSSLVersion)
114118
ExtendCondition(HasProxyVerifierVersion)
115119
ExtendCondition(IsBoringSSL)
@@ -119,3 +123,4 @@ ExtendCondition(HasCurlVersion)
119123
ExtendCondition(HasCurlFeature)
120124
ExtendCondition(HasCurlOption)
121125
ExtendCondition(PluginExists)
126+
ExtendCondition(CurlUsingUnixDomainSocket)

tests/gold_tests/autest-site/curl.test.ext

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Tools to help with TestRun commands
3030
#
3131

3232

33-
def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True):
33+
def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True, ts):
3434
ret = []
3535

3636
if self.Variables.get("CurlUds", False):
37-
cmdstr = 'curl --unix-socket /tmp/socket ' + cmdstr
37+
cmdstr = f'curl --unix-socket {ts.Variables.uds_path} ' + cmdstr
3838
else:
3939
cmdstr = 'curl ' + cmdstr
4040
if use_default:
@@ -48,24 +48,22 @@ def spawn_curl_commands(self, cmdstr, count, retcode=0, use_default=True):
4848
return ret
4949

5050

51-
def curl_command(self, cmd, p=None):
51+
def curl_command(self, cmd, ts, p=None):
5252
if p == None:
5353
p = self.Processes.Default
5454
if self.Variables.get("CurlUds", False):
55-
uds_path = os.path.join(p.RunDirectory, 'uds.socket')
56-
p.Command = f'curl --unix-socket {uds_path} ' + cmd
55+
p.Command = f'curl --unix-socket {ts.Variables.uds_path} ' + cmd
5756
else:
5857
p.Command = 'curl ' + cmd
5958
return p
6059

6160

62-
def curl_multiple_commands(self, cmd):
61+
def curl_multiple_commands(self, cmd, ts):
6362
p = self.Processes.Default
6463
if self.Variables.get("CurlUds", False):
65-
uds_path = os.path.join(p.RunDirectory, 'uds.socket')
66-
p.Command = cmd.format(curl=f'curl --unix-socket {uds_path}')
64+
p.Command = cmd.format(curl=f'curl --unix-socket {ts.Variables.uds_path}', curl_base='curl')
6765
else:
68-
p.Command = cmd.format(curl='curl')
66+
p.Command = cmd.format(curl='curl', curl_base='curl')
6967
return p
7068

7169

tests/gold_tests/autest-site/setup.cli.ext

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Variables.VerifierBinPath = ENV['VERIFIER_BIN']
116116
Variables.BuildRoot = ENV['BUILD_ROOT']
117117
Variables.RepoDir = repo_root
118118
Variables.AtsTestPluginsDir = os.path.join(Variables.BuildRoot, 'tests', 'tools', 'plugins', '.libs')
119-
Variables.AtsBuildGoldTestsDir = os.path.join(Variables.BuildRoot, 'tests', 'gold_tests')
119+
Variables.AtsBuildGoldTestsDir = os.path.join(Variables.BuildRoot, 'tests', 'gold_tests_filtered')
120120
Variables.CurlUds = Arguments.curl_uds
121121

122122
# modify delay times as we always have to kill Trafficserver

tests/gold_tests/autest-site/trafficserver.test.ext

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def MakeATSProcess(
368368
p.Variables.ssl_portv6 = 4444
369369

370370
# unix domain socket path
371-
uds_path = os.path.join(obj.RunDirectory, 'uds.socket')
371+
uds_path = os.path.join(runtime_dir, 'uds.socket')
372372
p.Variables.uds_path = uds_path
373373

374374
get_port(p, "manager_port")

tests/gold_tests/basic/basic.test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
t.StillRunningAfter = Test.Processes.ts
2626

2727
p = t.Processes.Default
28-
t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port))
28+
t.MakeCurlCommand("http://127.0.0.1:{0}".format(ts.Variables.port), ts=ts)
2929
p.ReturnCode = 0
3030
p.StartBefore(Test.Processes.ts)

tests/gold_tests/basic/config.test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
ts = Test.MakeATSProcess("ts", select_ports=False)
2222
ts.Variables.port = 8090
2323
ts.Disk.records_config.update({
24-
'proxy.config.http.server_ports': str(ts.Variables.port),
24+
'proxy.config.http.server_ports': str(ts.Variables.port) + f" {ts.Variables.uds_path}",
2525
})
2626
ts.Ready = When.PortOpen(ts.Variables.port)
2727
t = Test.AddTestRun("Test traffic server started properly")
2828
t.Processes.Default.StartBefore(ts)
29-
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts.Variables.port))
29+
t.MakeCurlCommand("127.0.0.1:{port}".format(port=ts.Variables.port), ts=ts)
3030
t.ReturnCode = 0
3131
t.StillRunningAfter = ts

0 commit comments

Comments
 (0)