diff --git a/dev-tools/mage/gotest.go b/dev-tools/mage/gotest.go index c21ac3eaa89..019f624a271 100644 --- a/dev-tools/mage/gotest.go +++ b/dev-tools/mage/gotest.go @@ -142,8 +142,12 @@ func GoTestIntegrationForModule(ctx context.Context) error { return err } + type moduleErr struct { + name string + err error + } foundModule := false - failedModules := []string{} + failedModules := []moduleErr{} for _, fi := range modulesFileInfo { if !fi.IsDir() { continue @@ -169,14 +173,23 @@ func GoTestIntegrationForModule(ctx context.Context) error { }) if err != nil { // err will already be report to stdout, collect failed module to report at end - failedModules = append(failedModules, fi.Name()) + failedModules = append(failedModules, moduleErr{ + name: fi.Name(), + err: err, + }) } } if module != "" && !foundModule { return fmt.Errorf("no module %s", module) } if len(failedModules) > 0 { - return fmt.Errorf("failed modules: %s", strings.Join(failedModules, ", ")) + errMsg := strings.Builder{} + names := []string{} + for _, m := range failedModules { + fmt.Fprintf(&errMsg, "Module: %s\nError: %s\n", m.name, m.err.Error()) + names = append(names, m.name) + } + return fmt.Errorf("failed modules: %s.\n%s", strings.Join(names, ", "), errMsg.String()) } return nil } diff --git a/metricbeat/module/kubernetes/_meta/test/docs/02_objects/cronjob.yaml b/metricbeat/module/kubernetes/_meta/test/docs/02_objects/cronjob.yaml index eba346cf155..8f334648489 100644 --- a/metricbeat/module/kubernetes/_meta/test/docs/02_objects/cronjob.yaml +++ b/metricbeat/module/kubernetes/_meta/test/docs/02_objects/cronjob.yaml @@ -1,7 +1,7 @@ # Cronjob that will execute each minute. # It will print a message and sleep (reporting being active) for 5 seconds -apiVersion: batch/v1beta1 +apiVersion: batch/v1 kind: CronJob metadata: name: mycronjob @@ -19,4 +19,4 @@ spec: restartPolicy: OnFailure terminationGracePeriodSeconds: 0 - concurrencyPolicy: Allow \ No newline at end of file + concurrencyPolicy: Allow diff --git a/metricbeat/module/kubernetes/kubernetes.yml b/metricbeat/module/kubernetes/kubernetes.yml index d87cb4f5f9b..7c4ffb58ae9 100644 --- a/metricbeat/module/kubernetes/kubernetes.yml +++ b/metricbeat/module/kubernetes/kubernetes.yml @@ -108,7 +108,7 @@ spec: requests: storage: 1Mi --- -apiVersion: batch/v1beta1 +apiVersion: batch/v1 kind: CronJob metadata: name: basic-cronjob