prepare(); } public function test_update_load_balancer_servers(): void { SSH::fake(); $this->actingAs($this->user); $servers = Server::query()->where('id', '!=', $this->server->id)->get(); $this->assertEquals(2, $servers->count()); $this->post(route('application.update-load-balancer', [ 'server' => $this->server->id, 'site' => $this->site->id, ]), [ 'method' => LoadBalancerMethod::ROUND_ROBIN, 'servers' => [ [ 'ip' => $servers[0]->local_ip, 'port' => 80, 'weight' => 1, 'backup' => false, ], [ 'ip' => $servers[1]->local_ip, 'port' => 80, 'weight' => 1, 'backup' => false, ], ], ]) ->assertSessionDoesntHaveErrors(); $this->assertDatabaseHas('load_balancer_servers', [ 'load_balancer_id' => $this->site->id, 'ip' => $servers[0]->local_ip, 'port' => 80, 'weight' => 1, 'backup' => false, ]); $this->assertDatabaseHas('load_balancer_servers', [ 'load_balancer_id' => $this->site->id, 'ip' => $servers[1]->local_ip, 'port' => 80, 'weight' => 1, 'backup' => false, ]); } }