()
| 40 | } |
| 41 | |
| 42 | func setupAPIForTestForInstance() (*API, *conf.Configuration, uuid.UUID, error) { |
| 43 | instanceID := uuid.Must(uuid.NewV4()) |
| 44 | cb := func(gc *conf.GlobalConfiguration, c *conf.Configuration, conn *storage.Connection) (uuid.UUID, error) { |
| 45 | err := conn.Create(&models.Instance{ |
| 46 | ID: instanceID, |
| 47 | UUID: testUUID, |
| 48 | BaseConfig: c, |
| 49 | }) |
| 50 | return instanceID, err |
| 51 | } |
| 52 | |
| 53 | api, conf, err := setupAPIForTestWithCallback(cb) |
| 54 | if err != nil { |
| 55 | return nil, nil, uuid.Nil, err |
| 56 | } |
| 57 | return api, conf, instanceID, nil |
| 58 | } |
| 59 | |
| 60 | func setupAPIForTestWithCallback(cb func(*conf.GlobalConfiguration, *conf.Configuration, *storage.Connection) (uuid.UUID, error)) (*API, *conf.Configuration, error) { |
| 61 | globalConfig, err := conf.LoadGlobal(apiTestConfig) |
no test coverage detected
searching dependent graphs…