Spec-Zone.ru › Chef 17

Ресурс google_compute_regions

[править на GitHub]

Синтаксис

Используется google_compute_regions, чтобы проверить ресурс Google Region.

Ресурс Beta

Этот ресурс имеет доступные поля beta. Чтобы получить эти поля, включите beta: true в конструктор ресурса.

Примеры

describe google_compute_regions(project: 'chef-gcp-inspec') do
  its('count') { should be >= 1 }
  its('region_names') { should include "#{gcp_location}" }
  its('region_statuses') { should_not include "DOWN" }
  its('region_ids') { should include "1290" }
end

Используйте этот ресурс InSpec для перечисления идентификаторов, а затем проведите углубленное тестирование с помощью google_compute_region

  google_compute_regions(project: 'chef-inspec-gcp').region_names.each do |region_name|
    describe google_compute_region(project: 'chef-inspec-gcp',  region: region_name) do
      it { should be_up }
    end
  end

Проверка наличия более определённого количества доступных регионов для проекта

describe google_compute_regions(project: 'chef-inspec-gcp') do
  its('count') { should be >= 10}
end

Проверка наличия ожидаемой области для проекта

describe google_compute_regions(project: 'chef-inspec-gcp') do
  its('region_names') { should include 'europe-west2' }
end

Проверка наличия регионов в состоянии “DOWN”

describe google_compute_regions(project: 'chef-inspec-gcp') do
  its('region_statuses') { should_not include "DOWN" }
end

Проверка, что подмножество всех регионов, соответствующих «europe*», находятся в состоянии “UP”

google_compute_regions(project: gcp_project_id).where(region_name: /^europe/).region_names.each do |region_name|
  describe google_compute_region(project: 'chef-inspec-gcp',  region: region_name) do
    it { should be_up }
  end
end

Свойства

Свойства, к которым можно получить доступ из ресурса google_compute_regions:

Дополнительную информацию см. в ресурсе google_compute_region.

creation_timestamps
массив google_compute_region creation_timestamp
deprecateds
массив google_compute_region deprecated
descriptions
массив google_compute_region description
region_ids
массив google_compute_region id
region_names
массив google_compute_region name
quotas
массив google_compute_region quotas
region_statuses
массив google_compute_region status
zones
массив google_compute_region zones

Критерии фильтрации

Этот ресурс поддерживает все вышеперечисленные свойства в качестве критериев фильтрации, которые могут быть использованы с where в виде блока или метода.

Разрешения GCP

Убедитесь, что API Compute Engine включен для текущего проекта.

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/google_compute_regions/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API