Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect header matching rules key in v2 pact files #426

Closed
Saup21 opened this issue Jun 21, 2024 · 1 comment
Closed

Incorrect header matching rules key in v2 pact files #426

Saup21 opened this issue Jun 21, 2024 · 1 comment

Comments

@Saup21
Copy link

Saup21 commented Jun 21, 2024

Software versions

  • OS: Mac OS Sonoma 14.5
  • Consumer Pact library: Pact go v2.0.5
  • Provider Pact library: pact-ruby v1.64.0
  • Golang Version: 1.18
  • Golang environment:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/sauparna.gupta/Library/Caches/go-build"
GOENV="/Users/sauparna.gupta/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/sauparna.gupta/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/sauparna.gupta/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/sauparna.gupta/services/terraform-provider-pact/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hj/4rhb2sfx3wjf51nnmn6r4vp80000gr/T/go-build690945761=/tmp/go-build -gno-record-gcc-switches -fno-common"

Expected behaviour

{
  "match": true,
  "comment": "Headers match with regex",
  "expected" : {
    "headers": {
      "Accept": "alligators",
      "Content-Type": "hippos"
    },
    "matchingRules": {
      "$.headers.Accept": {"match": "regex", "regex": "\\w+"}
    }
  },
  "actual": {
    "headers": {
      "Content-Type": "hippos",
      "Accept": "godzilla"
    }
  }
}

Actual behaviour

{
  "match": true,
  "comment": "Headers match with regex",
  "expected" : {
    "headers": {
      "Accept": "alligators",
      "Content-Type": "hippos"
    },
    "matchingRules": {
      "$.header.Accept": {"match": "regex", "regex": "\\w+"}
    }
  },
  "actual": {
    "headers": {
      "Content-Type": "hippos",
      "Accept": "godzilla"
    }
  }
}

The field should be $.headers.<key> not $.header.<key>

Steps to reproduce

It can be easily reproduced by just generating a pact file where a consumer test contains matching rules for header keys

Relevent log files

WARN: Ignoring unsupported matching rules {"match"=>"type"} for path $['header']['Authorization']

@YOU54F
Copy link
Member

YOU54F commented Sep 4, 2024

Thanks for raising @Saup21

Resolved in v2.0.8 of pact-go, with libpact_ffi 0.4.23

@YOU54F YOU54F closed this as completed Sep 4, 2024
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

No branches or pull requests

2 participants