Permalink
Browse files

unittest: rename functions for a better understanding

Signed-off-by: Alban Dericbourg <a.dericbourg@criteo.com>
  • Loading branch information...
adericbourg committed Sep 13, 2018
1 parent a8ec662 commit 03c5c9e77cc233bcb0a8ae1c08f1a183c2d87d96
Showing with 5 additions and 5 deletions.
  1. +3 −3 cmd/ratool/unittest.go
  2. +2 −2 cmd/ratool/utils.go
View
@@ -56,7 +56,7 @@ func (w *unittestCmd) Unittest(ctx *kingpin.ParseContext) error {
hasDiffs := false
for _, testContext := range testCfg.Tests {
fmt.Printf("## %s\n", testContext.Name)
output, err := makeOutput(testContext, graCfg)
output, err := makeSortedOutput(testContext, graCfg)
if err != nil {
level.Error(logger).Log("err", err, "msg", fmt.Sprintf("failed to generate output for test case %s", testContext.Name))
return err
@@ -93,7 +93,7 @@ func makeDiff(expected string, actual string) []string {
return nil
}
func makeOutput(testContext *testConfig, graCfg *config.Config) (string, error) {
func makeSortedOutput(testContext *testConfig, graCfg *config.Config) (string, error) {
samples, err := makeSamples(testContext.Input)
if err != nil {
return "", err
@@ -112,7 +112,7 @@ func makeOutput(testContext *testConfig, graCfg *config.Config) (string, error)
func makeSamples(input string) ([]*model.Sample, error) {
reader := strings.NewReader(input)
return readSamplesFile(reader)
return readSamples(reader)
}
type unittestConfig struct {
View
@@ -26,10 +26,10 @@ func loadSamplesFile(filename string) ([]*model.Sample, error) {
if err != nil {
return nil, err
}
return readSamplesFile(file)
return readSamples(file)
}
func readSamplesFile(reader io.Reader) ([]*model.Sample, error) {
func readSamples(reader io.Reader) ([]*model.Sample, error) {
dec := &expfmt.SampleDecoder{
Dec: expfmt.NewDecoder(reader, expfmt.FmtText),
Opts: &expfmt.DecodeOptions{

0 comments on commit 03c5c9e

Please sign in to comment.