npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@octopusdeploy/step-test-framework

v1.0.0

Published

Testing framework for Octopus Step Package Steps

Downloads

104

Readme

step-test-framework

An opinionated testing frame work for testing Octopus Step Package Steps.

npm i @octopusdeploy/step-test-framework --save-dev

Build and Publish

Overview

The Step Test Framework:

  • acquires and sets up Terraform
  • declares the required Terraform provider for your target (AzureRM, AWS, GCP)
  • provides TypeScript types for required Credentials, for example AzureCredentials
  • provides a simple entry point for setting up the test resources which accepts a path to a single TF file, and a credential
  • outputs a random resource code that can both be used in the step authors own terraform templates, and within the tests to access and validate resources
  • provides a destructor for the environment that can be used to reliably tear it down once tests are complete
  • returns all outputs defined in the test module as a single untyped object, ex.
test_module_output: any = {
  virtual_network_name: "octotetra"
}

Example

This example deploys a new vnet to Azure. The frame

|--
 - test-module.tf
 - test.spec.ts

test-module.tf

variable "resource_code" {
  type = string
}

variable "resource_group_name" {
  type = string
}

variable "resource_group_location" {
  type = string
}

resource "azurerm_virtual_network" "example" {
  name                = "octo${var.resource_code}"
  resource_group_name = var.resource_group_name
  location            = var.resource_group_location
  address_space       = ["10.254.0.0/16"]
}

output "virtual_network_name" {
  value = azurerm_virtual_network.example.name
}

test.spec.ts

const credentials: AzureCredentials = {
    client_id: clientId,
    subscription_id: subscriptionId,
    tenant_id: tenantId,
    client_secret: password,
};

const result = await setupAzureEnvironment(join(__dirname, "blob-storage.tf"), credentials);

// Use output values like result.test_module_output.virtual_network_name 
// or build up known resource names with result.resource_code
// to retrieve resources and validate desired state has been achieved

result.teardown();

Sensitive Output

If an output variable from your test module contains sensitive value (i.e. has sensitive = true in it), for example:

output "virtual_network_name" {
  value = azurerm_virtual_network.example.name
  sensitive = true
}

then you may get an error "Error: Output refers to sensitive values" indicating that the test_module_output output variable must also be marked as sensitive. To do this pass true to the sensitiveOutput parameter of the relevant platform specific setup function setupAzureEnvironment/setupAwsEnvironment. This will ensure that the test module is setup with the correct sensitive outputs. Note that the value of any sensitive outputs are not shown in the logged resources initialized during test fixtures.