-
Notifications
You must be signed in to change notification settings - Fork 500
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stability: add scale & upgrade case functions (#309)
* impl scale & upgrade cases
- Loading branch information
Showing
3 changed files
with
162 additions
and
36 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,50 @@ | ||
package tests | ||
|
||
import "strconv" | ||
|
||
func (tc *TidbClusterInfo) set(name string, value string) (string, bool) { | ||
// NOTE: not thread-safe, maybe make info struct immutable | ||
if tc.Args == nil { | ||
tc.Args = make(map[string]string) | ||
} | ||
origVal, ok := tc.Args[name] | ||
tc.Args[name] = value | ||
return origVal, ok | ||
} | ||
|
||
func (tc *TidbClusterInfo) ScalePD(replicas uint) *TidbClusterInfo { | ||
tc.set("pd.replicas", strconv.Itoa(int(replicas))) | ||
return tc | ||
} | ||
|
||
func (tc *TidbClusterInfo) ScaleTiKV(replicas uint) *TidbClusterInfo { | ||
tc.set("tikv.replicas", strconv.Itoa(int(replicas))) | ||
return tc | ||
} | ||
|
||
func (tc *TidbClusterInfo) ScaleTiDB(replicas uint) *TidbClusterInfo { | ||
tc.set("tidb.replicas", strconv.Itoa(int(replicas))) | ||
return tc | ||
} | ||
|
||
func (tc *TidbClusterInfo) UpgradePD(image string) *TidbClusterInfo { | ||
tc.PDImage = image | ||
return tc | ||
} | ||
|
||
func (tc *TidbClusterInfo) UpgradeTiKV(image string) *TidbClusterInfo { | ||
tc.TiKVImage = image | ||
return tc | ||
} | ||
|
||
func (tc *TidbClusterInfo) UpgradeTiDB(image string) *TidbClusterInfo { | ||
tc.TiDBImage = image | ||
return tc | ||
} | ||
|
||
func (tc *TidbClusterInfo) UpgradeAll(tag string) *TidbClusterInfo { | ||
return tc. | ||
UpgradePD("pingcap/pd:" + tag). | ||
UpgradeTiKV("pingcap/tikv:" + tag). | ||
UpgradeTiDB("pingcap/tidb:" + tag) | ||
} |
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