• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

m-lab / locate / 21039861677
83%

Build:
DEFAULT BRANCH: main
Ran 15 Jan 2026 05:15PM UTC
Jobs 1
Files 40
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

15 Jan 2026 05:12PM UTC coverage: 82.926% (+0.1%) from 82.781%
21039861677

push

github

web-flow
refactor(locatetest)!: allow returning valid URLs (#240)

The current implementation of the `locatetest` package does not allow to return valid URLs. As such, mocking a realistic locate response is not possible and testing is less realistic.

To address this, I propose to provide the `*TargetInfo` to the fake server directly. This design allows for maximum flexibility at the cost of slightly more sweating in the tests that use this package, for they would need to provide a fully populated response. (Though I added a constructor for the common case of `ndt7`, which can also serve as a reference implementation for creating the proper mocks elsewhere.)

Yet, this is probably the most flexible compromise in terms of decoupling the ability to run a local, fake locate and specifying what each specific user of `locatetest` needs.

BREAKING CHANGE: users of `locatetest.LocatorV2` now need to specify the full `*TargetInfo` as opposed to just passing the list of servers or use the convenience `NewTargetInfoNdt7` constructor (if that fits your needs). The following code illustrates a reasonable upgrade path that produces a valid ndt7 response:

```Go
// Change this
server := locatetest.NewLocateServerV2(&locatetest.LocatorV2{
    Servers: []string{"127.0.0.1"},
})

// Into this
server := locatetest.NewLocateServerV2(&locatetest.LocatorV2{
    TargetInfo: locatetest.NewTargetInfoNdt7("127.0.0.1"),
})
```

If you need to mock a `/v2/nearest` response for a different experiment, you should adapt `NewTargetInfoNdt7` to your use case. In such a case, we recommend comparing to the actual locate output to make the response realistic.

33 of 33 new or added lines in 1 file covered. (100.0%)

2273 of 2741 relevant lines covered (82.93%)

5.66 hits per line

Jobs
ID Job ID Ran Files Coverage
1 21039861677.1 15 Jan 2026 05:15PM UTC 40
82.93
GitHub Action Run
Source Files on build 21039861677
  • Tree
  • List 40
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 13aef12b on github
  • Prev Build on main (#20967370120)
  • Next Build on main (#21040680216)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc