Skip to content

Latest commit

 

History

History
68 lines (44 loc) · 2.21 KB

development_environment.md

File metadata and controls

68 lines (44 loc) · 2.21 KB

Development Environment Setup

Requirements

  • Go 1.17+ (to build the provider)
  • Terraform (to run integration tests)

Quick Start

Building

Clone the repository:

git clone https://github.com/cloudquery/cq-provider-aws

Build the provider:

make build

Running the provider in debug mode

  1. Download CloudQuery latest version.
  2. Execute make run and note of the CQ_REATTACH_PROVIDERS value.
  3. Open another terminal and run CQ_REATTACH_PROVIDERS=[VALUE_FROM_PREV] ./cloudquery fetch

Make sure the authentication variables are exported in the provider process and not in cloudquery process.

See docs for more details.

Testing

The provider has two types of tests:

  1. Unit Tests - run locally without any credentials and use mocking to return data from AWS APIs.
  2. Integration Tests - run against real AWS APIs and uses test environment defined with terraform under terraform/service_name/

Unit Tests

Unit Tests don't require any credentials or internet access

make test-unit # This runs go test ./...

Unit tests include:

  • Specific resources tests. You can find those next to each resource, in the resources/services folder.
  • DB migration tests. You can find the code for these tests here.
  • Client tests. You can find those in the client folder.

Integration Tests

These are documented in the Adding a new resource guide. See here for more information.

Pre-commit Hooks

This repository provides a pre-commit hook to check your code before committing it. To use it:

  1. Install pre-commit (on Mac OS: brew install pre-commit)
  2. Install golangci-lint (on Mac OS: brew install golangci-lint)
  3. In the root of this repo, run:
    make install-hooks

Now your code will be statically checked for errors prior to commit.