GithubHelp home page GithubHelp logo

Comments (2)

holomekc avatar holomekc commented on July 19, 2024 1

Seems like the features also creates issues, if mappings are created from a config map in k8s: holomekc#269

from wiremock.

jrs666666 avatar jrs666666 commented on July 19, 2024 1

Kubernetes mounts a ConfigMap containing just 2 unique stub mappings like this:

root@wiremock-66dc8ccf9b-2z8m2:/home/wiremock/mappings# ls -laR
.:
total 0
drwxrwxrwx. 3 root root 152 Jul  5 13:51 .
drwxr-xr-x. 1 root root  25 Jul  5 13:52 ..
drwxr-xr-x. 2 root root  98 Jul  5 13:51 ..2024_07_05_13_51_53.2567708330
lrwxrwxrwx. 1 root root  32 Jul  5 13:51 ..data -> ..2024_07_05_13_51_53.2567708330
lrwxrwxrwx. 1 root root  23 Jul  5 13:51 jwks.json -> ..data/jwks.json
lrwxrwxrwx. 1 root root  31 Jul  5 13:51 webhook-test.json -> ..data/webhook-test.json

./..2024_07_05_13_51_53.2567708330:
total 12
drwxr-xr-x. 2 root root   98 Jul  5 13:51 .
drwxrwxrwx. 3 root root  152 Jul  5 13:51 ..
-rw-r--r--. 1 root root  264 Jul  5 13:51 jwks.json
-rw-r--r--. 1 root root  432 Jul  5 13:51 webhook-test.json

Wiremock detects soft-linked files as well as the 'real' files inside the hierarchy as duplicates regardless of the file type and identical MD5 checksum:

MB-79-P16:wiremock $ md5sum mappings/..2024_07_05_13_51_53.2567708330/webhook-test.json mappings/webhook-test.json 

eb58ef4b72a411579d764c4d540ca1ae  mappings/..2024_07_05_13_51_53.2567708330/webhook-test.json
eb58ef4b72a411579d764c4d540ca1ae  mappings/webhook-test.json
Exception in thread "main" com.github.tomakehurst.wiremock.common.InvalidInputException: {
  "errors" : [ {
    "code" : 109,
    "title" : "Duplicate stub mapping ID",
    "detail" : "ID of the provided stub mapping '64c23b4a-5f94-427b-8b6e-f8c43ed5529d' is already taken by another stub mapping"
  } ]
}
        at com.github.tomakehurst.wiremock.stubbing.AbstractStubMappings.addMapping(AbstractStubMappings.java:169)
        at com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource.loadMappingsInto(JsonFileMappingsSource.java:120)
        at com.github.tomakehurst.wiremock.core.WireMockApp.loadMappingsUsing(WireMockApp.java:288)
        at com.github.tomakehurst.wiremock.core.WireMockApp.loadDefaultMappings(WireMockApp.java:282)
        at com.github.tomakehurst.wiremock.core.WireMockApp.<init>(WireMockApp.java:143)
        at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:74)
        at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:71)
        at wiremock.Run.main(Run.java:23)

My current work-around is using an init-container which find and copy just all real files from the k8s mounted directory to the mappings directory (find /home/wiremock/configmap-mappings/ -type f -exec cp '{}' /home/wiremock/mappings/ \;), which is somehow cumbersome.

from wiremock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.