@@ -21,7 +21,9 @@ import (
2121
2222 "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
2323 capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
24+ "github.com/smartcontractkit/chainlink-common/pkg/config"
2425 "github.com/smartcontractkit/chainlink-common/pkg/logger"
26+ "github.com/smartcontractkit/chainlink-common/pkg/settings/limits"
2527 wasmpb "github.com/smartcontractkit/chainlink-common/pkg/workflows/wasm/pb"
2628 valuespb "github.com/smartcontractkit/chainlink-protos/cre/go/values/pb"
2729)
@@ -943,8 +945,10 @@ func TestModule_CompressedBinarySize(t *testing.T) {
943945 require .NoError (t , bwr .Close ())
944946
945947 _ , err = NewModule (t .Context (), & ModuleConfig {IsUncompressed : false , Logger : logger .Test (t )}, binary )
946- default10mbLimit := fmt .Sprintf ("binary size exceeds the maximum allowed size of %d bytes" , defaultMaxCompressedBinarySize )
947- require .ErrorContains (t , err , default10mbLimit )
948+ require .ErrorContains (t , err , "binary size exceeds the maximum allowed size" )
949+ var limitErr limits.ErrorBoundLimited [config.Size ]
950+ require .ErrorAs (t , err , & limitErr )
951+ assert .Equal (t , defaultMaxCompressedBinarySize , int (limitErr .Limit ))
948952 })
949953
950954 t .Run ("compressed binary size is bigger than the custom limit" , func (t * testing.T ) {
@@ -958,8 +962,10 @@ func TestModule_CompressedBinarySize(t *testing.T) {
958962 require .NoError (t , bwr .Close ())
959963
960964 _ , err = NewModule (t .Context (), & ModuleConfig {IsUncompressed : false , MaxCompressedBinarySize : customMaxCompressedBinarySize , Logger : logger .Test (t )}, binary )
961- default10mbLimit := fmt .Sprintf ("binary size exceeds the maximum allowed size of %d bytes" , customMaxCompressedBinarySize )
962- require .ErrorContains (t , err , default10mbLimit )
965+ require .ErrorContains (t , err , "binary size exceeds the maximum allowed size" )
966+ var limitErr limits.ErrorBoundLimited [config.Size ]
967+ require .ErrorAs (t , err , & limitErr )
968+ assert .Equal (t , customMaxCompressedBinarySize , uint64 (limitErr .Limit ))
963969 })
964970}
965971
@@ -979,8 +985,10 @@ func TestModule_DecompressedBinarySize(t *testing.T) {
979985 t .Run ("decompressed binary size is bigger than the limit" , func (t * testing.T ) {
980986 customDecompressedBinarySize := uint64 (len (decompedBinary ) - 1 )
981987 _ , err := NewModule (t .Context (), & ModuleConfig {IsUncompressed : false , MaxDecompressedBinarySize : customDecompressedBinarySize , Logger : logger .Test (t )}, binary )
982- decompressedSizeExceeded := fmt .Sprintf ("decompressed binary size reached the maximum allowed size of %d bytes" , customDecompressedBinarySize )
983- require .ErrorContains (t , err , decompressedSizeExceeded )
988+ require .ErrorContains (t , err , "decompressed binary size reached the maximum allowed size" )
989+ var limitErr limits.ErrorBoundLimited [config.Size ]
990+ require .ErrorAs (t , err , & limitErr )
991+ assert .Equal (t , customDecompressedBinarySize , uint64 (limitErr .Limit ))
984992 })
985993}
986994
0 commit comments