Skip to content

Commit

Permalink
add labels to lantern resource in api as well
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed May 5, 2024
1 parent d0b3794 commit 33eb398
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions routes/api/project/lantern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class CloverApi
project_id: @project.id,
location: r.params["location"],
name: r.params["name"],
label: r.params["label"],
org_id: r.params["org_id"].to_i,
target_vm_size: parsed_size.vm_size,
target_storage_size_gib: r.params["storage_size_gib"] || parsed_size.storage_size_gib,
Expand Down
1 change: 1 addition & 0 deletions serializers/api/lantern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def self.base(pg)
parent_id: pg.parent_id,
path: pg.path,
name: pg.name,
label: pg.label,
state: pg.display_state,
instance_type: pg.representative_server&.instance_type,
location: pg.location,
Expand Down
3 changes: 2 additions & 1 deletion spec/routes/api/project/lantern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@

describe "create" do
it "creates new lantern database" do
post "/api/project/#{project.ubid}/lantern", {size: "n1-standard-2", name: "instance-2", org_id: 0, location: "us-central1", storage_size_gib: 100, lantern_version: "0.2.2", extras_version: "0.1.4", minor_version: "1", domain: "test.db.lantern.dev", app_env: "test", repl_password: "test-repl-pass", enable_telemetry: true, postgres_password: "test-pg-pass"}
post "/api/project/#{project.ubid}/lantern", {size: "n1-standard-2", name: "instance-2", label: "test-label", org_id: 0, location: "us-central1", storage_size_gib: 100, lantern_version: "0.2.2", extras_version: "0.1.4", minor_version: "1", domain: "test.db.lantern.dev", app_env: "test", repl_password: "test-repl-pass", enable_telemetry: true, postgres_password: "test-pg-pass"}

body = JSON.parse(last_response.body)
expect(last_response.status).to eq(200)

expect(body["name"]).to eq("instance-2")
expect(body["label"]).to eq("test-label")
expect(body["state"]).to eq("creating")
expect(body["instance_type"]).to eq("writer")
expect(body["location"]).to eq("us-central1")
Expand Down

0 comments on commit 33eb398

Please sign in to comment.