@@ -17,9 +17,51 @@ suite("test_internal_stage_http_data_api", "smoke") {
1717 def code = process. waitFor()
1818 def err = IOGroovyMethods . getText(new BufferedReader (new InputStreamReader (process. getErrorStream())));
1919 def out = process. getText()
20- logger. info(" Request FE Config: code=" + code + " , out=" + out + " , err=" + err)
20+ logger. info(" Http data api Request FE Config: code=" + code + " , out=" + out + " , err=" + err)
2121 assertEquals (code, 0 )
2222
23+ // if aliyun, test internal endpoint
24+ if (" oss" . equals(getProvider())) {
25+ def tmp = new StringBuilder (strBuilder)
26+ // test internal
27+ strBuilder. append(""" -H Host:www.selectdb.com --connect-timeout 5 -vv""" )
28+ command = strBuilder. toString()
29+ logger. info(" Test aliyun internal endpoint command=" + command)
30+ process = command. toString(). execute()
31+ code = process. waitFor()
32+ err = IOGroovyMethods . getText(new BufferedReader (new InputStreamReader (process. getErrorStream())));
33+ out = process. getText()
34+ def location = null
35+ err. eachLine {if (it. startsWith(" < Location" )) {
36+ location = it
37+ }}
38+ if (null == location) {
39+ assertTrue (false )
40+ }
41+ logger. info(" location: " + location)
42+ // < Location: http://selectdb-online-cn-shenzhen-bucket1667494333.oss-cn-shenzhen-internal.aliyuncs.com/m-xoad88n48839bauewv/stage/admin/admin/internal_customer.csv?Expires=1676956170&OSSAccessKeyId=LTAI5tCRA18qGLf6CiD9DFRv&Signature=GVFAAhSyNnZzFpXaakoc8gNietg%3D
43+ // oss-cn-shenzhen-internal, assert contain '-internal'
44+ assertTrue (location. toString(). contains(" -internal" ))
45+
46+ // test non internal, host is ip, so non internal
47+ tmp. append(""" -H Host:210.211.212.213:8888 --connect-timeout 5 -vv""" )
48+ command = tmp. toString()
49+ logger. info(" Test aliyun non internal endpoint command=" + command)
50+ process = command. toString(). execute()
51+ code = process. waitFor()
52+ err = IOGroovyMethods . getText(new BufferedReader (new InputStreamReader (process. getErrorStream())));
53+ out = process. getText()
54+ location = null
55+ err. eachLine {if (it. startsWith(" < Location" )) {
56+ location = it
57+ }}
58+ if (null == location) {
59+ assertTrue (false )
60+ }
61+ // curl -u admin:smoke_Test -H fileName:internal_customer.csv -T /mnt/disk3/smoke-test/bin/regression-test/data/cloud/smoke/copy_into/internal_customer.csv -L http://119.23.41.172:39590/copy/upload -H Host:210.211.212.213:8888 --connect-timeout 5 -vv
62+ assertFalse (location. toString(). contains(" -internal" ))
63+ }
64+
2365 try {
2466 sql """ DROP TABLE IF EXISTS ${ tableName} ; """
2567 sql """
0 commit comments