Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: removed wiremock stale comments and functions required

=d70edf13d3fd
diff --git a/tests/cmd/inf/main.go b/tests/cmd/inf/main.go
index 2188a1fbde..03ffa3cc18 100644
--- a/tests/cmd/inf/main.go
+++ b/tests/cmd/inf/main.go
@@ -95,18 +95,6 @@ func down() int {
}
fmt.Printf("removed %d container(s)\n", len(list))
}
- // Package networks too: an Isolated suite takes one of its own, named after the
- // package, and leaving them behind accumulates a network per suite.
- if nets, err := docker("network", "ls", "--format", "{{.Name}}", "--filter", "name="+infra.NetworkName); err == nil {
- for _, n := range strings.Fields(nets) {
- if n != infra.NetworkName {
- if _, err := docker("network", "rm", n); err == nil {
- fmt.Printf("removed network %s\n", n)
- }
- }
- }
- }
-
if _, err := docker("network", "rm", infra.NetworkName); err == nil {
fmt.Println("removed network " + infra.NetworkName)
}
diff --git a/tests/fakes/license/key.go b/tests/fakes/license/key.go
index 04e4c3ca6b..dacb7db7dd 100644
--- a/tests/fakes/license/key.go
+++ b/tests/fakes/license/key.go
@@ -16,7 +16,7 @@ import (
// that grants nothing.
//
// It deliberately does NOT need to be stable across processes, unlike AUTH_SECRET.
-// WireMock never verifies the signature, so a second test binary adopting a running
+// The license fake never verifies the signature, so a second test binary adopting a running
// instance can hold a different key and every call still succeeds. The only real
// constraint is that the client can parse it: it fails before sending anything if it
// cannot.
diff --git a/tests/harness/harness.go b/tests/harness/harness.go
index 3e6778d368..995d4f80f8 100644
--- a/tests/harness/harness.go
+++ b/tests/harness/harness.go
@@ -171,13 +171,10 @@ func bringUp(ctx context.Context, profile Profile, cfg *config, pkg string) (*St
return nil, nil, err
}
- // One network for everything, including Isolated packages.
- //
- // Isolated used to take its own, because two WireMocks on one network both
- // claimed api.github.com and Docker DNS round-robined between them. fakenet holds
- // no aliases -- it is reached as a resolver at a fixed address -- so that reason
- // is gone. Isolation for an Isolated package is about instance state, not the
- // network, and its containers are package-qualified by name anyway.
+ // One network for everything, including Isolated packages. fakenet is reached at
+ // a fixed address on it, and an Isolated package's containers are
+ // package-qualified by name, so isolation is about instance state rather than the
+ // network.
stackNet := infra.NetworkName
handles := map[infra.ModuleKey]infra.Handle{}
diff --git a/tests/harness/profile.go b/tests/harness/profile.go
index 2134f61ca8..c68c31b838 100644
--- a/tests/harness/profile.go
+++ b/tests/harness/profile.go
@@ -36,7 +36,7 @@ func (p Profile) String() string {
//
// A profile fixes the set completely, and that is load-bearing rather than tidy. A
// shared container is adopted by name and takes its environment at creation, so if
-// one package declared WireMock and another did not, whichever started the instance
+// one package declared fakenet and another did not, whichever started the instance
// first would silently decide whether it runs in cloud mode for everyone.
func (p Profile) modules(img infisical.Image, fnImg fakenet.Image, caFile string, extra ...infra.Module) ([]infra.Module, map[infra.ModuleKey]infra.Scope) {
own := infra.Shared
diff --git a/tests/infra/container.go b/tests/infra/container.go
index 97ed288497..684ffd1335 100644
--- a/tests/infra/container.go
+++ b/tests/infra/container.go
@@ -22,14 +22,6 @@ type ContainerSpec struct {
Ports []int
Alias string // primary network alias, which becomes the Internal host
- // Aliases are extra network aliases. WireMock uses them to answer for hostnames
- // a client resolves itself and would otherwise never send through a proxy.
- //
- // An alias belongs to the network, not the container, so two containers claiming
- // one on the same network make Docker DNS round-robin between them. That is why
- // an Isolated stack gets its own network rather than sharing.
- Aliases []string
-
// Network is which network to join. Empty means the runner's current one.
Network string
@@ -102,8 +94,4 @@ func (c Container) Exec(ctx context.Context, cmd []string) (int, string, error)
type Runner interface {
Run(ctx context.Context, spec ContainerSpec) (Container, error)
Network(ctx context.Context, name string) error
-
- // Connect attaches an already-running container to another network, which is how
- // a Shared container reaches an Isolated stack that lives on its own one.
- Connect(ctx context.Context, container, network string, aliases ...string) error
}
diff --git a/tests/infra/fakenet/fakenet.go b/tests/infra/fakenet/fakenet.go
index 7817810942..1a0e1dff08 100644
--- a/tests/infra/fakenet/fakenet.go
+++ b/tests/infra/fakenet/fakenet.go
@@ -124,9 +124,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.mu.Unlock()
// Every hostname resolves here, so an unfaked one arrives as a normal request
- // rather than failing to connect. Answering it with a 501 naming the URL is what
- // replaces WireMock's deny-all: a forgotten fake has to fail loudly, or a test
- // passes without exercising anything.
+ // rather than failing to connect. Answering it with a 501 naming the URL makes a
+ // forgotten fake fail loudly, instead of letting a test pass without exercising
+ // anything.
if !known {
s.refuse(w, r, host, "no fake is registered for this host")
return
diff --git a/tests/infra/module.go b/tests/infra/module.go
index 967f3c6788..7063ec5f73 100644
--- a/tests/infra/module.go
+++ b/tests/infra/module.go
@@ -88,7 +88,7 @@ func (d Deps) Log() Logger { return d.log }
// Get returns a typed handle, or false when the module was not declared.
//
// A generic method rather than a package function, which Go 1.27 allows. Modules
-// still wrap it (wiremock.From, postgres.MustFrom) so call sites read as prose.
+// still wrap it (fakenet.From, postgres.MustFrom) so call sites read as prose.
func (d Deps) Get[H Handle](k ModuleKey) (H, bool) {
h, ok := d.handles[k]
if !ok {
diff --git a/tests/infra/runner.go b/tests/infra/runner.go
index 0b3834a450..bc940e14de 100644
--- a/tests/infra/runner.go
+++ b/tests/infra/runner.go
@@ -61,11 +61,8 @@ func NewRunner(workspace string, log Logger) Runner {
// Network creates the shared network if it is absent, and is a no-op otherwise.
//
-// One per stack: the shared network for a Shared profile, and a package-specific one
-// for an Isolated profile so its WireMock can claim a host alias without competing
-// with the shared WireMock for the same name. Shared containers are connected to the
-// package network afterwards. testcontainers' network.New generates a random name per
-// process, which would give every test binary its own island.
+// Every profile shares the one named network. testcontainers' network.New generates
+// a random name per process, which would give every test binary its own island.
//
// Shelled out rather than using the Docker API. This runs once per machine, so a
// subprocess is free, and it keeps network creation independent of testcontainers.
@@ -103,28 +100,6 @@ func (r *dockerRunner) Network(ctx context.Context, name string) error {
return nil
}
-// Connect attaches a running container to another network.
-//
-// Needed because a Shared container is created once, on the shared network, and an
-// Isolated stack lives on its own: without this its Infisical could not reach the
-// shared fakenet. Adopting a container does not re-apply network options, so this
-// has to be an explicit step rather than something Run can do.
-func (r *dockerRunner) Connect(ctx context.Context, container, net string, aliases ...string) error {
- args := []string{"network", "connect"}
- for _, a := range aliases {
- args = append(args, "--alias", a)
- }
- args = append(args, net, container)
-
- out, err := exec.CommandContext(ctx, "docker", args...).CombinedOutput()
- // Already attached is the same outcome as attaching, and happens whenever a
- // second binary adopts a container the first one already connected.
- if err != nil && !strings.Contains(string(out), "already exists") {
- return fmt.Errorf("infra: connecting %s to %s: %w: %s", container, net, err, strings.TrimSpace(string(out)))
- }
- return nil
-}
-
func (r *dockerRunner) Run(ctx context.Context, spec ContainerSpec) (Container, error) {
opts := []testcontainers.ContainerCustomizer{
testcontainers.WithReuseByName(spec.Name),
@@ -157,8 +132,7 @@ func (r *dockerRunner) Run(ctx context.Context, spec ContainerSpec) (Container,
if alias == "" {
alias = spec.Name
}
- aliases := append([]string{alias}, spec.Aliases...)
- opts = append(opts, network.WithNetworkName(aliases, net))
+ opts = append(opts, network.WithNetworkName([]string{alias}, net))
if spec.IP != "" {
addr, err := netip.ParseAddr(spec.IP)