Skip to content

Commit

Permalink
rename functions and parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
tianfeng92 committed Sep 13, 2024
1 parent 69e15c2 commit 8735395
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/run/cucumber.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func runCucumber(cmd *cobra.Command, isCLIDriven bool) (int, error) {
props := usage.Properties{}
props.SetFramework("playwright-cucumberjs").SetFVersion(p.Playwright.Version).SetFlags(cmd.Flags()).SetSauceConfig(p.Sauce).
SetArtifacts(p.Artifacts).SetNPM(p.Npm).SetNumSuites(len(p.Suites)).
SetSlack(p.Notifications.Slack).SetSharding(cucumber.GetShardValues(p.Suites), cucumber.GetShardOpts(p.Suites)).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSlack(p.Notifications.Slack).SetSharding(cucumber.GetShardTypes(p.Suites), cucumber.GetShardOpts(p.Suites)).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSmartRetry(p.IsSmartRetried()).SetReporters(p.Reporters).SetNodeVersion(p.NodeVersion)
tracker.Collect(cases.Title(language.English).String(cmds.FullName(cmd)), props)
_ = tracker.Close()
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/cypress.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func runCypress(cmd *cobra.Command, cflags cypressFlags, isCLIDriven bool) (int,
props := usage.Properties{}
props.SetFramework("cypress").SetFVersion(p.GetVersion()).SetFlags(cmd.Flags()).SetSauceConfig(p.GetSauceCfg()).
SetArtifacts(p.GetArtifactsCfg()).SetNPM(p.GetNpm()).SetNumSuites(len(p.GetSuites())).
SetSlack(p.GetNotifications().Slack).SetSharding(p.GetShardValues(), p.GetShardOpts()).SetLaunchOrder(p.GetSauceCfg().LaunchOrder).
SetSlack(p.GetNotifications().Slack).SetSharding(p.GetShardTypes(), p.GetShardOpts()).SetLaunchOrder(p.GetSauceCfg().LaunchOrder).
SetSmartRetry(p.IsSmartRetried()).SetReporters(p.GetReporters()).SetNodeVersion(p.GetNodeVersion())

tracker.Collect(cases.Title(language.English).String(cmds.FullName(cmd)), props)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/espresso.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func runEspresso(cmd *cobra.Command, espressoFlags espressoFlags, isCLIDriven bo
props := usage.Properties{}
props.SetFramework("espresso").SetFlags(cmd.Flags()).SetSauceConfig(p.Sauce).SetArtifacts(p.Artifacts).
SetNumSuites(len(p.Suites)).SetSlack(p.Notifications.Slack).
SetSharding(espresso.GetShardValues(p.Suites), nil).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSharding(espresso.GetShardTypes(p.Suites), nil).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSmartRetry(p.IsSmartRetried()).SetReporters(p.Reporters)
tracker.Collect(cases.Title(language.English).String(cmds.FullName(cmd)), props)
_ = tracker.Close()
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/playwright.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func runPlaywright(cmd *cobra.Command, pf playwrightFlags, isCLIDriven bool) (in
props := usage.Properties{}
props.SetFramework("playwright").SetFVersion(p.Playwright.Version).SetFlags(cmd.Flags()).SetSauceConfig(p.Sauce).
SetArtifacts(p.Artifacts).SetNPM(p.Npm).SetNumSuites(len(p.Suites)).
SetSlack(p.Notifications.Slack).SetSharding(playwright.GetShardValues(p.Suites), playwright.GetShardOpts(p.Suites)).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSlack(p.Notifications.Slack).SetSharding(playwright.GetShardTypes(p.Suites), playwright.GetShardOpts(p.Suites)).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSmartRetry(p.IsSmartRetried()).SetReporters(p.Reporters).SetNodeVersion(p.NodeVersion)
tracker.Collect(cases.Title(language.English).String(cmds.FullName(cmd)), props)
_ = tracker.Close()
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/testcafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func runTestcafe(cmd *cobra.Command, tcFlags testcafeFlags, isCLIDriven bool) (i
props := usage.Properties{}
props.SetFramework("testcafe").SetFVersion(p.Testcafe.Version).SetFlags(cmd.Flags()).SetSauceConfig(p.Sauce).
SetArtifacts(p.Artifacts).SetNPM(p.Npm).SetNumSuites(len(p.Suites)).
SetSlack(p.Notifications.Slack).SetSharding(testcafe.GetShardValues(p.Suites), nil).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSlack(p.Notifications.Slack).SetSharding(testcafe.GetShardTypes(p.Suites), nil).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSmartRetry(p.IsSmartRetried()).SetReporters(p.Reporters).SetNodeVersion(p.NodeVersion)
tracker.Collect(cases.Title(language.English).String(cmds.FullName(cmd)), props)
_ = tracker.Close()
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/run/xcuitest.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func runXcuitest(cmd *cobra.Command, xcuiFlags xcuitestFlags, isCLIDriven bool)
props := usage.Properties{}
props.SetFramework("xcuitest").SetFlags(cmd.Flags()).SetSauceConfig(p.Sauce).SetArtifacts(p.Artifacts).
SetNumSuites(len(p.Suites)).SetSlack(p.Notifications.Slack).
SetSharding(xcuitest.GetShardValues(p.Suites), nil).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSharding(xcuitest.GetShardTypes(p.Suites), nil).SetLaunchOrder(p.Sauce.LaunchOrder).
SetSmartRetry(p.IsSmartRetried()).SetReporters(p.Reporters)
tracker.Collect(cases.Title(language.English).String(cmds.FullName(cmd)), props)
_ = tracker.Close()
Expand Down
4 changes: 2 additions & 2 deletions internal/cucumber/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ func FilterSuites(p *Project, suiteName string) error {
return fmt.Errorf("no suite named '%s' found", suiteName)
}

// GetShardValues returns the shard values.
func GetShardValues(suites []Suite) []string {
// GetShardTypes returns the shard types in a project.
func GetShardTypes(suites []Suite) []string {
var set = map[string]bool{}
for _, s := range suites {
if s.Shard != "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/cypress/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Project interface {
ApplyFlags(selectedSuite string) error
AppendTags([]string)
Validate() error
GetShardValues() []string
GetShardTypes() []string
GetShardOpts() map[string]bool

SetDefaults()
Expand Down
4 changes: 2 additions & 2 deletions internal/cypress/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ func (p *Project) GetSuite() suite.Suite {
}
}

// GetShardValues returns the shard values.
func (p *Project) GetShardValues() []string {
// GetShardTypes returns the shard types in a project.
func (p *Project) GetShardTypes() []string {
var set = map[string]bool{}
for _, s := range p.Suites {
if s.Shard != "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/espresso/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func FilterSuites(p *Project, suiteName string) error {
return fmt.Errorf(msg.SuiteNameNotFound, suiteName)
}

func GetShardValues(suites []Suite) []string {
func GetShardTypes(suites []Suite) []string {
var set = map[string]bool{}
for _, suite := range suites {
if v, ok := suite.TestOptions["numShards"]; ok {
Expand Down
2 changes: 1 addition & 1 deletion internal/playwright/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ func FilterSuites(p *Project, suiteName string) error {
return fmt.Errorf(msg.SuiteNameNotFound, suiteName)
}

func GetShardValues(suites []Suite) []string {
func GetShardTypes(suites []Suite) []string {
var set = map[string]bool{}
for _, s := range suites {
if s.NumShards > 1 {
Expand Down
2 changes: 1 addition & 1 deletion internal/testcafe/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func FilterSuites(p *Project, suiteName string) error {
return fmt.Errorf("no suite named '%s' found", suiteName)
}

func GetShardValues(suites []Suite) []string {
func GetShardTypes(suites []Suite) []string {
var set = map[string]bool{}
for _, s := range suites {
if s.Shard != "" {
Expand Down
6 changes: 3 additions & 3 deletions internal/usage/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func (p Properties) SetSlack(slack config.Slack) Properties {
return p
}

func (p Properties) SetSharding(shardValues []string, shardOpts map[string]bool) Properties {
p["sharded"] = len(shardValues) > 0
p["shard_values"] = shardValues
func (p Properties) SetSharding(shardTypes []string, shardOpts map[string]bool) Properties {
p["sharded"] = len(shardTypes) > 0
p["shard_types"] = shardTypes
for k, v := range shardOpts {
p[k] = v
}
Expand Down
2 changes: 1 addition & 1 deletion internal/xcuitest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func getShardedSuites(suite Suite, ccy int) ([]Suite, error) {
return suites, nil
}

func GetShardValues(suites []Suite) []string {
func GetShardTypes(suites []Suite) []string {
var set = map[string]bool{}
for _, s := range suites {
if s.Shard != "" {
Expand Down

0 comments on commit 8735395

Please sign in to comment.