mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
Some checks failed
CI / 🤖 Check dependabot status (push) Has been cancelled
CI / 🐧 Test on Linux (${{ github.ref_type == 'tag' }}, misc) (push) Has been cancelled
CI / 🐧 Test on Linux (coverage) (push) Has been cancelled
CI / 🐧 Test on Linux (regular) (push) Has been cancelled
CI / ❄️ Build on Nix (push) Has been cancelled
CI / 🍏 Build and test on macOS (push) Has been cancelled
CI / 🧪 End-to-end testing (push) Has been cancelled
CI / 🔍 Upload code coverage (push) Has been cancelled
CI / 🔬 Test only Go (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 20) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 22) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 24) (push) Has been cancelled
CI / ⚖️ Check licenses (push) Has been cancelled
CI / 🐋 Build Docker images (push) Has been cancelled
CI / 🐋 Tag Docker images (push) Has been cancelled
CI / 🚀 Publish release (push) Has been cancelled
Otherwise, the default is "false" for verify. This is a breaking change. Fix #2055.
81 lines
1.8 KiB
Go
81 lines
1.8 KiB
Go
// SPDX-FileCopyrightText: 2025 Free Mobile
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package helpers_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"akvorado/common/helpers"
|
|
)
|
|
|
|
func TestTLSConfigurationMigration(t *testing.T) {
|
|
helpers.TestConfigurationDecode(t, helpers.ConfigurationDecodeCases{
|
|
{
|
|
Description: "new skip-verify field",
|
|
Initial: func() any { return helpers.TLSConfiguration{} },
|
|
Configuration: func() any {
|
|
return gin.H{
|
|
"enable": true,
|
|
"skip-verify": true,
|
|
}
|
|
},
|
|
Expected: helpers.TLSConfiguration{
|
|
Enable: true,
|
|
SkipVerify: true,
|
|
},
|
|
}, {
|
|
Description: "no verify/skip-verify",
|
|
Initial: func() any { return helpers.TLSConfiguration{} },
|
|
Configuration: func() any {
|
|
return gin.H{
|
|
"enable": true,
|
|
}
|
|
},
|
|
Expected: helpers.TLSConfiguration{
|
|
Enable: true,
|
|
SkipVerify: false,
|
|
},
|
|
}, {
|
|
Description: "old verify=true migrates to skip-verify=false",
|
|
Initial: func() any { return helpers.TLSConfiguration{} },
|
|
Configuration: func() any {
|
|
return gin.H{
|
|
"enable": true,
|
|
"verify": true,
|
|
}
|
|
},
|
|
Expected: helpers.TLSConfiguration{
|
|
Enable: true,
|
|
SkipVerify: false,
|
|
},
|
|
}, {
|
|
Description: "old verify=false migrates to skip-verify=true",
|
|
Initial: func() any { return helpers.TLSConfiguration{} },
|
|
Configuration: func() any {
|
|
return gin.H{
|
|
"enable": true,
|
|
"verify": false,
|
|
}
|
|
},
|
|
Expected: helpers.TLSConfiguration{
|
|
Enable: true,
|
|
SkipVerify: true,
|
|
},
|
|
}, {
|
|
Description: "both verify and skip-verify causes error",
|
|
Initial: func() any { return helpers.TLSConfiguration{} },
|
|
Configuration: func() any {
|
|
return gin.H{
|
|
"enable": true,
|
|
"verify": true,
|
|
"skip-verify": false,
|
|
}
|
|
},
|
|
Error: true,
|
|
},
|
|
})
|
|
}
|