Ruby DnsMock v1.0.0 Release Notes

Release Date: 2021-01-29 // about 3 years ago
  • ➕ Added

    • 🔧 Configurable strategy for record not found case

    🤡 By default it won't raise an exception when DNS record not found in mocked records dictionary:

    DnsMock.start_server(port: 5300)
    
    dig @localhost -p 5300 A example.com
    
    ; <<>> DiG 9.10.6 <<>> @localhost -p 5300 A example.com
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38632
    ;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
    ;; WARNING: recursion requested but not available
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 4096
    ;; QUESTION SECTION:
    ;example.com.           IN  A
    
    ;; Query time: 0 msec
    ;; SERVER: 127.0.0.1#5300(127.0.0.1)
    ;; WHEN: Fri Jan 29 08:21:30 EET 2021
    ;; MSG SIZE  rcvd: 40
    

    If you want raise an exception when record not found, just start DnsMock with exception_if_not_found: true option:

    DnsMock.start_server(exception_if_not_found: true)
    

    🔄 Changed

    • ⚡️ Updated DnsMock.start_server
    • ⚡️ Updated DnsMock::Server
    • ⚡️ Updated DnsMock::Response::Message
    • ⚡️ Updated DnsMock::Response::Answer
    • ⚡️ Updated gem version, readme