Skip to content

Enabling Node SDK with new test framework#491

Draft
sagar-okta wants to merge 1 commit into
masterfrom
sv-OKTA-1158624
Draft

Enabling Node SDK with new test framework#491
sagar-okta wants to merge 1 commit into
masterfrom
sv-OKTA-1158624

Conversation

@sagar-okta

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Adding Tests
  • Build related changes
  • CI related changes
  • Documentation changes
  • Other... Please describe:

What is the current behavior?

Issue Number: https://oktainc.atlassian.net/browse/OKTA-1158624

The Node.js SDK has no auto-generated integration test infrastructure. Tests must be written manually, making it difficult to maintain coverage as the API surface grows.

What is the new behavior?

Introduces a generated test framework for the Okta Node.js SDK, mirroring the pattern used in the Java SDK (OKTA-1103933).

New files:

  • test-setup.sh — Orchestration script with three phases: setup (terraform init + apply), test (run generated tests with TF outputs injected), destroy (terraform teardown). Usage: bash test-setup.sh [setup|test|destroy|all]
  • scripts/generate-tests.sh — Docker-based script that generates test files from the OpenAPI spec (spec/management.yaml) using openapitools/openapi-generator-cli:v7.13.0 and copies them to src/generated/tests/
  • templates/openapi-generator/api/api_test.mustache — Mustache template for generating per-API test files. Tests use a PresetHelper to resolve Terraform outputs into prerequisite data for each operation.
  • templates/swagger-codegen-tests-config.json — Codegen configuration for test generation
  • okta-config.yaml.example — Template for local credentials file (the actual okta-config.yaml is gitignored)

Modified files:

  • .gitignore — Adds okta-config.yaml (credentials), src/generated/tests/ (generated files), tmp_test_gen/ (temp build dir), test/generated/utils.js
  • .eslintignore — Adds src/generated/tests/ to prevent linting auto-generated files
  • package.json — Adds two new scripts:
    • generate:tests — runs scripts/generate-tests.sh to regenerate test files from spec
    • test:generated — runs all generated tests via mocha

Local setup (not committed):

  • okta-config.yaml — Local credentials file (gitignored)
  • terraform/ — Per-API Terraform directories for provisioning test prerequisites (not committed, must be sourced separately)

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

To run the generated tests locally:

  1. Copy okta-config.yaml.example to okta-config.yaml and fill in credentials
  2. Place the terraform/ directory in the repo root (sourced from the test infrastructure repo)
  3. Run yarn generate:tests to generate test files from the spec
  4. Run bash test-setup.sh all to provision resources, run tests, and destroy

The src/generated/tests/ directory is gitignored — test files are always regenerated from the spec at runtime.

Reviewers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant