diff --git a/lib/cove/configuration/contracts/service_contract.rb b/lib/cove/configuration/contracts/service_contract.rb index a058e23..8fe1fca 100644 --- a/lib/cove/configuration/contracts/service_contract.rb +++ b/lib/cove/configuration/contracts/service_contract.rb @@ -22,14 +22,7 @@ class ServiceContract < Dry::Validation::Contract end end - role_names = [] - rule(:roles).each do |index:| - if index == 0 - role_names.clear - end - key([:roles, index, :name]).failure("#{value[:name]} is not a valid name. The name for each role must be unique.") if role_names.include?(value[:name]) - role_names << value[:name] if value[:ingress].present? value[:ingress].each_with_index do |ingress, ingress_index| source_key = key([:roles, index, :ingress, ingress_index, :source]) diff --git a/spec/cove/configuration/contracts/service_contract_spec.rb b/spec/cove/configuration/contracts/service_contract_spec.rb index 4933268..a5e718f 100644 --- a/spec/cove/configuration/contracts/service_contract_spec.rb +++ b/spec/cove/configuration/contracts/service_contract_spec.rb @@ -35,22 +35,6 @@ expect(result.success?).to eq(true) end - context "name" do - it "fails when a role does not have a name" do - contract = Cove::Configuration::Contracts::ServiceContract.new - result = contract.call(service_name: "a", image: "b", roles: [{container_count: 2}]) - expect(result.errors[:roles][0][:name]).to be_present - expect(result.success?).to eq(false) - end - - it "fails with duplicate role names" do - contract = Cove::Configuration::Contracts::ServiceContract.new - result = contract.call(service_name: "nginx", image: "nginx:1.23.4", roles: [{name: "web"}, {name: "web"}, {name: "web2"}]) - expect(result.errors[:roles][1][:name]).to be_present - expect(result.success?).to eq(false) - end - end - context "container_count" do it "succeeds when container_count is not included" do contract = Cove::Configuration::Contracts::ServiceContract.new