Skip to content

Conversation

@it-percona
Copy link

it-percona commented Mar 11, 2020

CLA assistant check
All committers have signed the CLA.

continue
}
instance := instance
wg.Add(1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only cuddled expressions if assigning variable or using from line above (from wsl)

@codecov
Copy link

codecov bot commented Mar 11, 2020

Codecov Report

Merging #41 into master will increase coverage by 0.24%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #41      +/-   ##
==========================================
+ Coverage   81.64%   81.89%   +0.24%     
==========================================
  Files           9        9              
  Lines         741      751      +10     
==========================================
+ Hits          605      615      +10     
  Misses        118      118              
  Partials       18       18
Impacted Files Coverage Δ
config/config.go 43.75% <ø> (ø) ⬆️
sessions/sessions.go 83.48% <100%> (+0.62%) ⬆️
basic/collector.go 94.11% <100%> (+0.56%) ⬆️
enhanced/scraper.go 77.47% <100%> (+0.62%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2688e80...2c98741. Read the comment docs.

assert.Equal(t, expectedMetrics, actualMetrics)
}

func TestCollectorDisableBasicMetrics(t *testing.T) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func TestCollectorDisableBasicMetrics is unused (from unused)

func TestCollectorDisableBasicMetrics(t *testing.T) {
cfg, err := config.Load("../config.tests.yml")
require.NoError(t, err)
client := client.New()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assignments should only be cuddled with other assignments (from wsl)

cfg, err := config.Load("../config.tests.yml")
require.NoError(t, err)
client := client.New()
for i := range cfg.Instances {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one cuddle assignment allowed before range statement (from wsl)

for i := range cfg.Instances {
cfg.Instances[i].DisableBasicMetrics = true
}
sess, err := sessions.New(cfg.Instances, client.HTTP(), false)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assignments should only be cuddled with other assignments (from wsl)


actualMetrics := helpers.ReadMetrics(helpers.CollectMetrics(c))
actualLines := helpers.Format(helpers.WriteMetrics(actualMetrics))
for _, line := range actualLines {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one cuddle assignment allowed before range statement (from wsl)

assert.Falsef(
t,
strings.Contains(inst.Instance, line),
"Instance %s with disabled metrics reseive: %s",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

receive?

require.NoError(t, err)
client := client.New()
for i := range cfg.Instances {
cfg.Instances[i].DisableBasicMetrics = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's disable only part of our instances to check that tests work.

return true
}
}
return false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return statements should not be cuddled if block has more than two lines (from wsl)

instanceGroups := make(map[bool][]string, 2)
for i := range cfg.Instances {
// Disable basic metrics in odd instances.
isDisabled := i%2 == 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mnd: Magic number: 2, in detected (from gomnd)

for i := range cfg.Instances {
// Disable basic metrics in even instances.
// This disable instance: no-such-instance.
isDisabled := i%2 == 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mnd: Magic number: 2, in detected (from gomnd)

@askomorokhov askomorokhov requested a review from BupycHuk March 13, 2020 16:22
}
}

func TestScraperDisableEnhancedMetrics(t *testing.T) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func TestScraperDisableEnhancedMetrics is unused (from unused)

func TestScraperDisableEnhancedMetrics(t *testing.T) {
cfg, err := config.Load("../config.tests.yml")
require.NoError(t, err)
client := client.New()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assignments should only be cuddled with other assignments (from wsl)

cfg, err := config.Load("../config.tests.yml")
require.NoError(t, err)
client := client.New()
for i := range cfg.Instances {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one cuddle assignment allowed before range statement (from wsl)

return true
}
}
return false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return statements should not be cuddled if block has more than two lines (from wsl)

for i := range cfg.Instances {
// Disable enhanced metrics in even instances.
// This disable instance: no-such-instance.
isDisabled := i%2 == 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mnd: Magic number: 2, in detected (from gomnd)

@AlekSi AlekSi merged commit db4ca34 into master Mar 19, 2020
@AlekSi AlekSi deleted the PMM-4145-rds-disable-metric-collection branch March 19, 2020 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants