You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
744 B
28 lines
744 B
1 month ago
|
package configLoad
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestLoadConfig(t *testing.T) {
|
||
|
path := "./config.yaml"
|
||
|
configYaml := loadConfigFromYaml(path)
|
||
|
kafkaAddr := configYaml.GetStringSlice("kafka.brokers")
|
||
|
redisAddr := configYaml.GetStringSlice("redis.address")
|
||
|
log.Printf("Kafka brokers is %v", kafkaAddr)
|
||
|
log.Printf("Redis address is %v", redisAddr)
|
||
|
}
|
||
|
|
||
|
func Test_LoadConfig(t *testing.T) {
|
||
|
configYaml := LoadConfig()
|
||
|
redisAdd := configYaml.GetString("redis.address")
|
||
|
alarmTopic := configYaml.GetString("kafka.topics.alarm")
|
||
|
kafkaBrokers := configYaml.GetStringSlice("kafka.brokers")
|
||
|
|
||
|
log.Printf("Kafka brokers is %v", redisAdd)
|
||
|
log.Printf("Kafka topics alarm is %v", alarmTopic)
|
||
|
log.Printf("Redis address is %v", kafkaBrokers)
|
||
|
|
||
|
}
|