> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# astro dev upgrade-test

<Info>The behavior and format of this command are the same for both Astro and Astro Private Cloud.</Info>

Test your local Astro project against a new version of Astro Runtime to prepare for an upgrade. Specifically, this command will run the following tests:

* Identify major and minor version changes of the Python packages in your upgrade version.
* Identify dag import errors that will appear after you upgrade.

See [Test before upgrading your Astro project](/docs/cli/v1.42/test-your-astro-project-locally) for more detailed information about usage and test results.

## Usage

```bash wrap theme={null}
astro dev upgrade-test
```

By default, the command runs all three available tests on your project against the latest version of Astro Runtime.

## Options

| Option                       | Description                                                                                                                                                                                                                                     | Possible Values                                                                                                                          |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `-a`, `--airflow-version`    | The equivalent of Airflow you want to upgrade to. The default is the latest available version. Note that the Astro CLI will still test against an Astro Runtime image based on the Airflow version you specify.                                 | Any valid [Airflow version](https://airflow.apache.org/docs/apache-airflow/stable/release_notes.html).                                   |
| `--build-secrets`            | Run `docker build --secret` to mount a secret value to your Docker image.                                                                                                                                                                       | `id=<your-secret-id>, src=<path-to-secret> .` See [Docker documentation](https://docs.docker.com/build/building/secrets/#secret-mounts). |
| `-d`, `--dag-test`           | Only run dag tests. These tests check whether your dags will generate import errors after you upgrade.                                                                                                                                          | None                                                                                                                                     |
| `-i`, `--deployment-id`      | Specify a Deployment ID to test with an image from an Astro Deployment instead of the image listed in your Astro project Dockerfile.                                                                                                            | Any valid Deployment ID.                                                                                                                 |
| `-n`, `--image-name`         | A custom image with an upgraded image tag to test against. The CLI creates a new Dockerfile in your project named `upgrade-test-<old version>--<new version>/Dockerfile` that includes your upgraded image, then tests against that Dockerfile. | A valid image URL                                                                                                                        |
| `-v`, `--runtime-version`    | The version of Astro Runtime you want to upgrade to. The default is the latest available version.                                                                                                                                               | Any valid [Astro runtime version](/docs/runtime/runtime-release-notes).                                                                       |
| `--use-astronomer-certified` | Test against an Astronomer Certified distribution of Airflow. Must be used with `--airflow-version`.                                                                                                                                            | None                                                                                                                                     |
| `--version-test`             | Only run version tests. These tests show you how the versions of your dependencies will change after you upgrade.                                                                                                                               | None                                                                                                                                     |
| `--fix`                      | Automatically fix linting issues identified by the upgrade test using ruff.                                                                                                                                                                     | None                                                                                                                                     |
| `--lint-deprecations`        | Include deprecation warnings in lint tests (set to false by default).                                                                                                                                                                           | true, false                                                                                                                              |

## Examples

* Run all tests before upgrading to the latest version of Astro Runtime:

  ```bash wrap theme={null}
  astro dev upgrade-test
  ```

* Test an Astro project file against a the Astro Runtime distribution of a Airflow 2.6.3:

  ```bash wrap theme={null}
  astro dev upgrade-test --airflow-version 2.6.3
  ```

* Include deprecation warnings in lint tests (exports to `ruff-lint-results.txt`):
  ```bash wrap theme={null}
  astro dev upgrade-test --lint-deprecations=true
  ```

* Test only dependency version changes against the Astro Runtime distribution for Airflow 2.6.3:

  ```bash wrap theme={null}
  astro dev upgrade-test --airflow-version 2.6.3 --provider-check
  ```

* Test a custom image for an upgrade to a custom versioned distribution of Astro Runtime:

  ```bash wrap theme={null}
  astro dev upgrade-test --image-name quay.io/example-organization/new-example-organization-image:1.0.7
  ```

  If you were upgrading from `quay.io/example-organization/new-example-organization-image:1.0.5`, for example, the Astro CLI creates a new Dockerfile located in `upgrade-test-1.0.5--1.0.7/Dockerfile` that contains the image you specified and tests against it.

## Related commands

* [`astro dev pytest`](/docs/cli/v1.42/astro-dev-pytest)
* [`astro dev parse`](/docs/cli/v1.42/astro-dev-parse)
