(t *testing.T)
| 14 | } |
| 15 | |
| 16 | func TestFolderStorage(t *testing.T) { |
| 17 | s := &FolderStorage{StorageDir: testing_helper.TempDir(t)} |
| 18 | ctx := context.Background() |
| 19 | |
| 20 | module := testModule("basic") |
| 21 | |
| 22 | // A module shouldn't exist at first... |
| 23 | _, ok, err := s.Dir(module) |
| 24 | if err != nil { |
| 25 | t.Fatalf("err: %s", err) |
| 26 | } |
| 27 | if ok { |
| 28 | t.Fatal("should not exist") |
| 29 | } |
| 30 | |
| 31 | key := "foo" |
| 32 | |
| 33 | // We can get it |
| 34 | err = s.Get(ctx, key, module, false) |
| 35 | if err != nil { |
| 36 | t.Fatalf("err: %s", err) |
| 37 | } |
| 38 | |
| 39 | // Now the module exists |
| 40 | dir, ok, err := s.Dir(key) |
| 41 | if err != nil { |
| 42 | t.Fatalf("err: %s", err) |
| 43 | } |
| 44 | if !ok { |
| 45 | t.Fatal("should exist") |
| 46 | } |
| 47 | |
| 48 | mainPath := filepath.Join(dir, "main.tf") |
| 49 | if _, err := os.Stat(mainPath); err != nil { |
| 50 | t.Fatalf("err: %s", err) |
| 51 | } |
| 52 | } |
nothing calls this directly
no test coverage detected