This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use make and docker-compose from the root folder
- Loading branch information
1 parent
82ddc77
commit 899d593
Showing
2 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package test | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
) | ||
|
||
type testCluster struct { | ||
path string | ||
originalWorkDir string | ||
} | ||
|
||
func newTestCluster(path string) (*testCluster, error) { | ||
workDir, err := os.Getwd() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if path == "" { | ||
parentDir := filepath.Dir(workDir) | ||
if err := os.Chdir(parentDir); err != nil { | ||
return nil, err | ||
} | ||
} | ||
|
||
return &testCluster{ | ||
path: path, | ||
originalWorkDir: workDir, | ||
}, nil | ||
} | ||
|
||
func (t *testCluster) start() ([]byte, error) { | ||
return exec.Command("make", "run-docker").CombinedOutput() | ||
} | ||
|
||
func (t *testCluster) stop() ([]byte, error) { | ||
return exec.Command("make", "stop-docker").CombinedOutput() | ||
} | ||
|
||
func (t *testCluster) reset() error { | ||
return os.Chdir(t.originalWorkDir) | ||
} |