AlinsRan commented on code in PR #12935:
URL: https://github.com/apache/apisix/pull/12935#discussion_r3671694162


##########
t/stream-node/tls.t:
##########
@@ -133,3 +148,171 @@ fetch table plugins
 release table ctx_var
 release table plugins
 release table api_ctx
+
+
+
+=== TEST 6: stream tls supports $ENV certificate reference
+--- config
+    location /t {
+        content_by_lua_block {
+            local core = require("apisix.core")
+            local t = require("lib.test_admin")
+
+            local data = {
+                cert = "$ENV://APISIX_STREAM_ENV_CERT",
+                key  = "$ENV://APISIX_STREAM_ENV_KEY",
+                sni  = "test.com",
+            }
+
+            local code, body = t.test('/apisix/admin/ssls/1',
+                ngx.HTTP_PUT,
+                core.json.encode(data)
+            )
+
+            if code >= 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            local code, body = t.test('/apisix/admin/stream_routes/1',
+                ngx.HTTP_PUT,
+                [[{
+                    "upstream": {
+                        "nodes": {
+                            "127.0.0.1:1995": 1
+                        },
+                        "type": "roundrobin"
+                    }
+                }]]
+            )
+
+            if code >= 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            ngx.say("passed")
+        }
+    }
+--- request
+GET /t
+--- response_body
+passed
+
+
+
+=== TEST 7: hit stream route with $ENV cert reference
+--- stream_tls_request
+mmm
+--- stream_sni: test.com
+--- response_body
+hello world
+
+
+
+=== TEST 8: store cert and key in vault for stream tls
+--- exec
+VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' \
+vault kv put kv/apisix/ssl \
+    test.com.crt="$(cat t/certs/apisix.crt)" \
+    test.com.key="$(cat t/certs/apisix.key)"
+--- response_body_like
+Success!.*
+
+
+
+=== TEST 9: set secret provider (vault) for stream tls
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+
+            local code, body = t('/apisix/admin/secrets/vault/stream-test',
+                ngx.HTTP_PUT,
+                [[{
+                    "uri": "http://0.0.0.0:8200";,
+                    "prefix": "kv/apisix",
+                    "token": "root"
+                }]],
+                [[{
+                    "key": "/apisix/secrets/vault/stream-test",
+                    "value": {
+                        "uri": "http://0.0.0.0:8200";,
+                        "prefix": "kv/apisix",
+                        "token": "root"
+                    }
+                }]]
+            )
+            if code >= 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+            ngx.say(body)
+        }
+    }
+--- response_body

Review Comment:
   This block has no `--- request` section, so Test::Nginx bails out and fails 
the whole job:
   
   ```
   Bailout called.  Further testing stopped:  t/stream-node/tls.t TEST 9: set 
secret provider (vault) for stream tls - Request line should be non-empty
   FAILED--Further testing stopped
   ```
   
   (latest CI run: 
https://github.com/apache/apisix/actions/runs/29131704520/job/90457355340)
   
   TEST 6 and TEST 10 have it; only this one is missing:
   
   ```
   --- request
   GET /t
   --- response_body
   passed
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to