Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NOTICE-fips.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3641,11 +3641,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Dependency : github.com/go-viper/mapstructure/v2
Version: v2.2.1
Version: v2.3.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/go-viper/mapstructure/v2@v2.2.1/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/go-viper/mapstructure/v2@v2.3.0/LICENSE:

The MIT License (MIT)

Expand Down
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3641,11 +3641,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Dependency : github.com/go-viper/mapstructure/v2
Version: v2.2.1
Version: v2.3.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/go-viper/mapstructure/v2@v2.2.1/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/go-viper/mapstructure/v2@v2.3.0/LICENSE:

The MIT License (MIT)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor v0.6.0
github.com/fatih/color v1.18.0
github.com/fsnotify/fsnotify v1.9.0
github.com/go-viper/mapstructure/v2 v2.2.1
github.com/go-viper/mapstructure/v2 v2.3.0
github.com/gofrs/flock v0.12.1
github.com/gofrs/uuid/v5 v5.3.1
github.com/google/go-cmp v0.7.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,8 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U=
github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/go-viper/mapstructure/v2 v2.3.0 h1:27XbWsHIqhbdR5TIC911OfYvgSaW93HM+dX7970Q7jk=
github.com/go-viper/mapstructure/v2 v2.3.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/go-zookeeper/zk v1.0.4 h1:DPzxraQx7OrPyXq2phlGlNSIyWEsAox0RJmjTseMV6I=
github.com/go-zookeeper/zk v1.0.4/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw=
github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU=
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/otel/run_nofips_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestStartCollector(t *testing.T) {
},
{
configFile: "nonexistent-component.yml",
expectedErrorMessage: `error decoding 'extensions': unknown type: "zpages"`,
expectedErrorMessage: `'extensions' unknown type: "zpages"`,
},
}

Expand Down
26 changes: 20 additions & 6 deletions pkg/component/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package component

import (
"errors"
"encoding/json"
"fmt"
"os"
"path/filepath"
Expand All @@ -16,15 +16,14 @@ import (
"testing"
"time"

"github.com/elastic/go-ucfg"

"github.com/elastic/elastic-agent-client/v7/pkg/client"
"github.com/elastic/elastic-agent-client/v7/pkg/proto"
"github.com/elastic/elastic-agent-libs/logp"

"github.com/elastic/elastic-agent/internal/pkg/agent/transpiler"
"github.com/elastic/elastic-agent/internal/pkg/eql"
"github.com/elastic/go-ucfg"

"github.com/go-viper/mapstructure/v2"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"google.golang.org/protobuf/types/known/structpb"
Expand Down Expand Up @@ -700,7 +699,7 @@ func TestToComponents(t *testing.T) {
ID: "filestream-default-filestream-1",
Type: client.UnitTypeInput,
LogLevel: defaultUnitLogLevel,
Err: fmt.Errorf("decoding error: %w", fmt.Errorf("decoding failed due to the following error(s):\n\n%w", errors.Join(errors.New("'meta' expected a map, got 'slice'")))),
Err: fmt.Errorf("decoding error: %w", makeMapStructureErr(t)),
},
},
RuntimeManager: DefaultRuntimeManager,
Expand Down Expand Up @@ -790,7 +789,7 @@ func TestToComponents(t *testing.T) {
ID: "cloudbeat-default-cloudbeat-1-unit",
Type: client.UnitTypeInput,
LogLevel: defaultUnitLogLevel,
Err: fmt.Errorf("decoding error: %w", fmt.Errorf("decoding failed due to the following error(s):\n\n%w", errors.Join(errors.New("'meta' expected a map, got 'slice'")))),
Err: fmt.Errorf("decoding error: %w", makeMapStructureErr(t)),
},
},
RuntimeManager: DefaultRuntimeManager,
Expand Down Expand Up @@ -3118,3 +3117,18 @@ func TestFlattenedDataStreamIsolatedUnits(t *testing.T) {
}
}
}

func makeMapStructureErr(t *testing.T) error {
t.Helper()

jsonStr := `{ "meta": [] }`

var data map[string]interface{}
err := json.Unmarshal([]byte(jsonStr), &data)
require.NoError(t, err)

var output struct {
Meta struct{} `mapstructure:"meta"`
}
return mapstructure.Decode(data, &output)
}
2 changes: 1 addition & 1 deletion pkg/component/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func TestExpectedConfig(t *testing.T) {
},
},
},
Err: errors.New("decoding error: decoding failed due to the following error(s):\n\n'meta' expected a map, got 'slice'"),
Err: errors.New("decoding error: decoding failed due to the following error(s):\n\n'meta' expected a map or struct, got \"slice\""),
},
}

Expand Down