| 71 | ) |
| 72 | |
| 73 | func init() { |
| 74 | //HACK(auxten) if we were running go test |
| 75 | if strings.HasSuffix(os.Args[0], ".test") || |
| 76 | strings.HasSuffix(os.Args[0], ".test.exe") || |
| 77 | strings.HasPrefix(filepath.Base(os.Args[0]), "___") { |
| 78 | _, testFile, _, _ := runtime.Caller(0) |
| 79 | confFile := filepath.Join(filepath.Dir(testFile), "config.yaml") |
| 80 | log.WithField("conf", confFile).Debug("current test filename") |
| 81 | log.Debugf("os.Args: %#v", os.Args) |
| 82 | |
| 83 | var err error |
| 84 | conf.GConf, err = conf.LoadConfig(confFile) |
| 85 | if err != nil { |
| 86 | log.WithError(err).Fatal("load config for test in kms failed") |
| 87 | } |
| 88 | InitBP() |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | // InitBP initializes kms.BP struct with conf.GConf. |
| 93 | func InitBP() { |