mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2024-12-12 17:41:08 +01:00
fe14f63217
- Ability to run a command pre up and post down - Ability to be a client in one mesh and a peer in the other - Added dev card to specify different sync rate, keepalive rate per mesh.
67 lines
1.3 KiB
Go
67 lines
1.3 KiB
Go
package conf
|
|
|
|
import "testing"
|
|
|
|
func getExampleConfiguration() *DaemonConfiguration {
|
|
return &DaemonConfiguration{
|
|
CertificatePath: "./cert/cert.pem",
|
|
PrivateKeyPath: "./cert/key.pem",
|
|
CaCertificatePath: "./cert/ca.pems",
|
|
SkipCertVerification: true,
|
|
}
|
|
}
|
|
|
|
func TestConfigurationCertificatePathEmpty(t *testing.T) {
|
|
conf := getExampleConfiguration()
|
|
conf.CertificatePath = ""
|
|
|
|
err := ValidateDaemonConfiguration(conf)
|
|
|
|
if err == nil {
|
|
t.Fatal(`error should be thrown`)
|
|
}
|
|
}
|
|
|
|
func TestConfigurationPrivateKeyPathEmpty(t *testing.T) {
|
|
conf := getExampleConfiguration()
|
|
conf.PrivateKeyPath = ""
|
|
|
|
err := ValidateDaemonConfiguration(conf)
|
|
|
|
if err == nil {
|
|
t.Fatal(`error should be thrown`)
|
|
}
|
|
}
|
|
|
|
func TestConfigurationCaCertificatePathEmpty(t *testing.T) {
|
|
conf := getExampleConfiguration()
|
|
conf.CaCertificatePath = ""
|
|
|
|
err := ValidateDaemonConfiguration(conf)
|
|
|
|
if err == nil {
|
|
t.Fatal(`error should be thrown`)
|
|
}
|
|
}
|
|
|
|
func TestConfigurationGrpcPortEmpty(t *testing.T) {
|
|
conf := getExampleConfiguration()
|
|
conf.GrpcPort = 0
|
|
|
|
err := ValidateDaemonConfiguration(conf)
|
|
|
|
if err == nil {
|
|
t.Fatal(`error should be thrown`)
|
|
}
|
|
}
|
|
|
|
func TestValidConfiguration(t *testing.T) {
|
|
conf := getExampleConfiguration()
|
|
|
|
err := ValidateDaemonConfiguration(conf)
|
|
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|