shreemaan-abhishek commented on issue #10218:
URL: https://github.com/apache/apisix/issues/10218#issuecomment-1736715378

   I am struggling to get this task to completion.
   
   The upstream nodes created using server configs are indeed healthy and 
accessible but the healthcheck API (that is being called in TEST 3) returns an 
empty object. Not to mention, everything works just fine when testing manually.
   
   ```perl
   use t::APISIX 'no_plan';
   
   no_root_location();
   
   add_block_preprocessor(sub {
       my ($block) = @_;
   
       if (!$block->http_config) {
           my $http_config = <<'_EOC_';
   server {
       listen 8765 ssl;
       ssl_certificate ../../certs/mtls_server.crt;
       ssl_certificate_key ../../certs/mtls_server.key;
       ssl_client_certificate ../../certs/mtls_ca.crt;
       ssl_verify_client on;
   
       location /index {
           return 200 'gangnam style!\n';
       }
   }
   server {
       listen 8766 ssl;
       ssl_certificate ../../certs/mtls_server.crt;
       ssl_certificate_key ../../certs/mtls_server.key;
       ssl_client_certificate ../../certs/mtls_ca.crt;
       ssl_verify_client on;
   
       location /index {
           return 200 'gangnam style!\n';
       }
   }
   _EOC_
           $block->set_value("http_config", $http_config);
       }
   
       if (!$block->request) {
           $block->set_value("request", "GET /t");
       }
   
   });
   
   run_tests;
   
   __DATA__
   
   === TEST 1: https health check
   --- log_level: info
   --- config
       location /t {
           content_by_lua_block {
               local t = require("lib.test_admin")
               local core = require("apisix.core")
               local cert = t.read_file("t/certs/mtls_client.crt")
               local key =  t.read_file("t/certs/mtls_client.key")
               local data = {
                   retries = 2,
                   checks = {
                       active = {
                           https_verify_certificate = false,
                           healthy = {
                               interval = 2,
                               successes = 1
                           },
                           unhealthy = {
                               interval = 1,
                               http_failures = 2
                           },
                           type = "https",
                           timeout = 5
                       },
                   },
                   type = "roundrobin",
                   nodes = {
                       ["127.0.0.1:8765"] = 1,
                       ["127.0.0.1:8766"] = 1
                   },
                   scheme = "https",
                   tls = {
                       client_cert = cert,
                       client_key = key
                   }
               }
               local code, body = t.test('/apisix/admin/upstreams/1',
                    ngx.HTTP_PUT,
                    core.json.encode(data)
               )
   
               if code >= 300 then
                   ngx.status = code
               end
   
               local code, body = t.test('/apisix/admin/routes/1',
                    ngx.HTTP_PUT,
                    [[{
                           "upstream_id": 1,
                           "uri": "/index"
                   }]]
               )
   
               if code >= 300 then
                   ngx.status = code
               end
           }
       }
   --- error_code: 200
   --- timeout: 15
   
   
   
   === TEST 2: ACCESS
   --- pipelined_requests eval
   ["GET /index", "GET /index", "GET /index", "GET /index", "GET /index", "GET 
/index", "GET /index", "GET /index"]
   --- error_code eval
   [200, 200, 200, 200, 200, 200, 200, 200]
   --- ignore_error_log
   
   
   
   === TEST 3: Healthcheck
   --- request
   GET /v1/healthcheck/upstreams/1
   --- response_body
   xyz
   
   ```


-- 
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