Skip to content

Commit

Permalink
change: remove self-contained info fields from ssl definition (#10323)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn0rt authored Oct 13, 2023
1 parent 2650551 commit 167f886
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 62 deletions.
6 changes: 0 additions & 6 deletions apisix/schema_def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -778,10 +778,6 @@ _M.ssl = {
},
required = {"ca"},
},
exptime = {
type = "integer",
minimum = 1588262400, -- 2020/5/1 0:0:0
},
labels = labels_def,
status = {
description = "ssl status, 1 to enable, 0 to disable",
Expand All @@ -798,8 +794,6 @@ _M.ssl = {
enum = {"TLSv1.1", "TLSv1.2", "TLSv1.3"}
},
},
validity_end = timestamp_def,
validity_start = timestamp_def,
create_time = timestamp_def,
update_time = timestamp_def
},
Expand Down
70 changes: 14 additions & 56 deletions t/admin/ssl.t
Original file line number Diff line number Diff line change
Expand Up @@ -268,45 +268,7 @@ passed



=== TEST 9: store exptime
--- config
location /t {
content_by_lua_block {
local core = require("apisix.core")
local t = require("lib.test_admin")

local ssl_cert = t.read_file("t/certs/apisix.crt")
local ssl_key = t.read_file("t/certs/apisix.key")
local data = {
cert = ssl_cert, key = ssl_key,
sni = "bar.com",
exptime = 1588262400 + 60 * 60 * 24 * 365,
}

local code, body = t.test('/apisix/admin/ssls/1',
ngx.HTTP_PUT,
core.json.encode(data),
[[{
"value": {
"sni": "bar.com",
"exptime": 1619798400
},
"key": "/apisix/ssls/1"
}]]
)

ngx.status = code
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed



=== TEST 10: string id
=== TEST 9: string id
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -334,7 +296,7 @@ passed



=== TEST 11: string id(delete)
=== TEST 10: string id(delete)
--- config
location /t {
content_by_lua_block {
Expand All @@ -361,7 +323,7 @@ passed



=== TEST 12: invalid id
=== TEST 11: invalid id
--- config
location /t {
content_by_lua_block {
Expand All @@ -388,7 +350,7 @@ GET /t



=== TEST 13: set ssl with multicerts(id: 1)
=== TEST 12: set ssl with multicerts(id: 1)
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -429,7 +391,7 @@ passed



=== TEST 14: mismatched certs and keys
=== TEST 13: mismatched certs and keys
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -467,7 +429,7 @@ GET /t



=== TEST 15: set ssl(with labels)
=== TEST 14: set ssl(with labels)
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -505,7 +467,7 @@ passed



=== TEST 16: invalid format of label value: set ssl
=== TEST 15: invalid format of label value: set ssl
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -542,7 +504,7 @@ GET /t



=== TEST 17: create ssl with manage fields(id: 1)
=== TEST 16: create ssl with manage fields(id: 1)
--- config
location /t {
content_by_lua_block {
Expand All @@ -554,19 +516,15 @@ GET /t
local data = {
cert = ssl_cert,
key = ssl_key,
sni = "test.com",
validity_start = 1602873670,
validity_end = 1603893670
sni = "test.com"
}

local code, body = t.test('/apisix/admin/ssls/1',
ngx.HTTP_PUT,
core.json.encode(data),
[[{
"value": {
"sni": "test.com",
"validity_start": 1602873670,
"validity_end": 1603893670
"sni": "test.com"
},
"key": "/apisix/ssls/1"
}]]
Expand All @@ -583,7 +541,7 @@ passed



=== TEST 18: delete test ssl(id: 1)
=== TEST 17: delete test ssl(id: 1)
--- config
location /t {
content_by_lua_block {
Expand All @@ -599,7 +557,7 @@ GET /t



=== TEST 19: create/patch ssl
=== TEST 18: create/patch ssl
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -664,7 +622,7 @@ passed



=== TEST 20: missing sni information
=== TEST 19: missing sni information
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -695,7 +653,7 @@ GET /t



=== TEST 21: type client, missing sni information
=== TEST 20: type client, missing sni information
--- config
location /t {
content_by_lua_block {
Expand Down

0 comments on commit 167f886

Please sign in to comment.