-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagefile.go
42 lines (33 loc) · 879 Bytes
/
magefile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//go:build mage
// +build mage
package main
import (
"fmt"
"github.com/magefile/mage/sh"
)
var Aliases = map[string]interface{} {
"r": StartRedis,
"s": StopRedis,
}
var (
defaultRedisHost string = "0"
defaultRedisPort string = "32000"
)
// Default target to run when none is specified
// If not set, running mage will list available targets
var Default = StartRedis
func StartRedis() (err error) {
fmt.Print("Launching testing Redis cluster")
err = sh.RunV("docker-compose", "up", "--detach", "--remove-orphans")
return
}
func StopRedis() (err error) {
fmt.Print("Stopping testing Redis cluster")
err = sh.RunV("docker-compose", "down", "--remove-orphans")
return
}
func ListRedis() (err error) {
fmt.Print("Listing testing Redis shards\n")
err = sh.RunV("redis-cli", "-h", defaultRedisHost, "-p", defaultRedisPort, "cluster", "nodes")
return
}