Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test workflow #52

Conversation

vishwahiremat
Copy link
Contributor

@vishwahiremat vishwahiremat commented Nov 22, 2023

Added a new workflow test.yaml:

  • Create a k3d registry and upload local-dev recipes to it.
  • Create a test bicep file that registers all the recipes to the environment and deploys all the recipes and test against the magpie container.

Addresses radius-project/radius#5775

Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
@vishwahiremat vishwahiremat changed the title Adding workflow and tests Adding test workflow Nov 29, 2023
APP_NAME: local-dev-recipe-app
APP_NAMESPACE: local-dev-recipe-app
jobs:
test:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not supposed to run on forks please add the if check like this: https://github.com/radius-project/radius/blob/main/.github/workflows/assets.yaml#L29.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check be added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking we should run this on fork as well, wondering if there is reason why we dont want to run on forks?

name: local_dev_recipe_test_container_logs-pod-logs
path: recipe-tests/pod-logs/local_dev_recipe_test_container_logs
retention-days: 30
if-no-files-found: error

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: new line and reformat file

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may need a reformat and a new line here


@description('Memory limit for the rabbitmq deployment')
param memoryLimit string = '1024Mi'
param memoryLimit string = '2048Mi'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we need to increase the limits? Increasing the memory request should be fine in my opinion. Do we need to add any limits and/or requests for the CPU?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing something while testing the recipe, there is no need to increase the limits. I will revert these changes back

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were they reverted?

Comment on lines 128 to 125
queue: queue
queue: 'queue'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this pointing to an object before and now why is it a string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it was pointing to string as well. I corrected it here to the right queue name

@@ -17,17 +17,14 @@ limitations under the License.
@description('Information about what resource is calling this Recipe. Generated by Radius. For more information visit https://docs.radapp.dev/operations/custom-recipes/')
param context object

@description('Name of the queue. Defaults to the name of the Radius RabbitMQ resource.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being removed? Usually we default these to be the name of the resource but allow them to be overridden

local-dev/secretstores.bicep Outdated Show resolved Hide resolved
@@ -75,7 +65,7 @@ resource sql 'apps/Deployment@v1' = {
{
// This container is the running sql instance.
name: 'sql'
image: 'mcr.microsoft.com/azure-sql-edge:${tag}'
image: 'mcr.microsoft.com/mssql/server:2022-latest'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing the container image as part of this PR? Did azure sql edge not work as expected?

mongoazure: {
templateKind: 'bicep'
plainHTTP: true
templatePath: 'reciperegistry:5000/recipes/local-dev/mongodatabases:latest'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make reciperegistry:5000 a parameter with a default value so it could be overridden if needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And could we make latest a parameter as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

container: {
image: magpieimage
env: {
CONNECTION_SQL_CONNECTIONSTRING: db.connectionString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being set manually?

tests/test-local-dev-recipes.bicep Show resolved Hide resolved
id: wait-for-pods
run: |
label="radapp.io/application=${APP_NAME}"
kubectl wait --for=condition=Ready pod -l $label -n ${APP_NAMESPACE} --timeout=5m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this where we wait for the tests to complete? Does the magpie container not move to ready until all its tests are complete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right magpie container does move to ready until all tests are complete, I just added one more step to check all pods are running fine after readiness check passed.

RAD_CLI_URL=https://raw.githubusercontent.com/radius-project/radius/main/deploy/install.sh
RAD_CLI_EDGE_URL=ghcr.io/radius-project/rad/linux-amd64:latest

if [[ $VERSION == "edge" ]]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still have edge version accessible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APP_NAME: local-dev-recipe-app
APP_NAMESPACE: local-dev-recipe-app
jobs:
test:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check be added?

- name: Install Dapr
run: |
helm repo add dapr https://dapr.github.io/helm-charts/
helm install dapr dapr/dapr --version=1.6 --namespace dapr-system --create-namespace --wait
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try to use more recent Dapr if that doesn't break anything.

id: wait-for-pods
run: |
label="radapp.io/application=${APP_NAME}"
kubectl wait --for=condition=Ready pod -l $label -n ${APP_NAMESPACE} --timeout=5m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willdavsmith found another command that basically waits for the deployment to finish. You may want to check that one. It should in one of the merged PRs in the samples repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated it

name: local_dev_recipe_test_container_logs-pod-logs
path: recipe-tests/pod-logs/local_dev_recipe_test_container_logs
retention-days: 30
if-no-files-found: error
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may need a reformat and a new line here


@description('Memory limit for the rabbitmq deployment')
param memoryLimit string = '1024Mi'
param memoryLimit string = '2048Mi'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were they reverted?

@@ -17,17 +17,14 @@ limitations under the License.
@description('Information about what resource is calling this Recipe. Generated by Radius. For more information visit https://docs.radapp.dev/operations/custom-recipes/')
param context object

@description('Name of the queue. Defaults to the name of the Radius RabbitMQ resource.')
param queue string = context.resource.name
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove this?

@@ -17,9 +17,6 @@ limitations under the License.
@description('Information about what resource is calling this Recipe. Generated by Radius. For more information visit https://docs.radapp.dev/operations/custom-recipes/')
param context object

@description('Name of the SQL database. Defaults to the name of the Radius SQL resource.')
param database string = context.resource.name
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why this was also removed?

@@ -75,7 +65,7 @@ resource sql 'apps/Deployment@v1' = {
{
// This container is the running sql instance.
name: 'sql'
image: 'mcr.microsoft.com/azure-sql-edge:${tag}'
image: 'mcr.microsoft.com/mssql/server:2022-latest'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2022-latest is not an image that will change, right? Not like latest?

Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Copy link

@ytimocin ytimocin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I think @AaronCrawfis should also take a look.

@@ -47,5 +47,6 @@ output result object = {
type: daprType
version: daprVersion
metadata: daprComponent.spec.metadata
componentName: daprComponent.metadata.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? And if so should we add it to all the other dapr recipes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not required, removed it

Comment on lines 3 to 7
param magpieimage string

param registry string

param version string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add descriptions to these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added descriptions

Copy link
Contributor

@AaronCrawfis AaronCrawfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple small things but overall looks great!

Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
@vishwahiremat vishwahiremat merged commit 5cd81f3 into radius-project:main Dec 7, 2023
2 checks passed
@SantaHub
Copy link

SantaHub commented May 23, 2024

@vishwahiremat hi i was tryna do a local deployment but having trouble with the local registry, would you help me figure what exactly its complaining about?
Few things i made sure :

  1. The recipe is available when you do rad recipe list
  2. Recipe is published successfully and use the --plain-http param when i published it
  3. the deploy is tryna fetch it from the localhost, the right port and using the http.

What i need help with, its tryna fetch the manifest, how do i make sure that available ?

here is the full error if it helps

Error: {
  "code": "DeploymentFailed",
  "message": "At least one resource deployment operation failed. Please see the details for the specific operation that failed.",
  "target": "/planes/radius/local/resourceGroups/default/providers/Microsoft.Resources/deployments/rad-deploy-ee7764d4-a055-4ea7-afa5-ab81c1a5d2ff",
  "details": [
    {
      "code": "ResourceDeploymentFailure",
      "message": "Failed",
      "target": "/planes/radius/local/resourceGroups/default/providers/Applications.Datastores/redisCaches/db",
      "details": [
        {
          "code": "RecipeDownloadFailed",
          "message": "code RecipeLanguageFailure: err failed to fetch repository from the path \"localhost:51351/recipes/local-dev/rediscache:0.0.1\": Head \"http://localhost:51351/v2/recipes/local-dev/rediscache/manifests/0.0.1\": dial tcp 127.0.0.1:51351: connect: connection refused",
          "details": [
            {
              "code": "RecipeLanguageFailure",
              "message": "failed to fetch repository from the path \"localhost:51351/recipes/local-dev/rediscache:0.0.1\": Head \"http://localhost:51351/v2/recipes/local-dev/rediscache/manifests/0.0.1\": dial tcp 127.0.0.1:51351: connect: connection refused"
            }
          ]
        }
      ]
    }
  ]
}

@vishwahiremat
Copy link
Contributor Author

vishwahiremat commented May 24, 2024

@vishwahiremat hi i was tryna do a local deployment but having trouble with the local registry, would you help me figure what exactly its complaining about? Few things i made sure :

  1. The recipe is available when you do rad recipe list
  2. Recipe is published successfully and use the --plain-http param when i published it
  3. the deploy is tryna fetch it from the localhost, the right port and using the http.

What i need help with, its tryna fetch the manifest, how do i make sure that available ?

here is the full error if it helps

Error: {
  "code": "DeploymentFailed",
  "message": "At least one resource deployment operation failed. Please see the details for the specific operation that failed.",
  "target": "/planes/radius/local/resourceGroups/default/providers/Microsoft.Resources/deployments/rad-deploy-ee7764d4-a055-4ea7-afa5-ab81c1a5d2ff",
  "details": [
    {
      "code": "ResourceDeploymentFailure",
      "message": "Failed",
      "target": "/planes/radius/local/resourceGroups/default/providers/Applications.Datastores/redisCaches/db",
      "details": [
        {
          "code": "RecipeDownloadFailed",
          "message": "code RecipeLanguageFailure: err failed to fetch repository from the path \"localhost:51351/recipes/local-dev/rediscache:0.0.1\": Head \"http://localhost:51351/v2/recipes/local-dev/rediscache/manifests/0.0.1\": dial tcp 127.0.0.1:51351: connect: connection refused",
          "details": [
            {
              "code": "RecipeLanguageFailure",
              "message": "failed to fetch repository from the path \"localhost:51351/recipes/local-dev/rediscache:0.0.1\": Head \"http://localhost:51351/v2/recipes/local-dev/rediscache/manifests/0.0.1\": dial tcp 127.0.0.1:51351: connect: connection refused"
            }
          ]
        }
      ]
    }
  ]
}

Hi @SantaHub ,
Thanks for sharing the details, From the information it looks like cluster is not able to connect to the registry. I would like to know how the cluster and local registries are crated. can you provide the command used to create the cluster and registry and the command you used to register the recipe.

@rynowak
Copy link
Contributor

rynowak commented May 24, 2024

From the error message, it looks like the issue is the hostname localhost:51351. Radius is running inside your cluster, so the address of the container registry won't be the same as it was when you published the recipe (from your computer, not inside a kubernetes cluster).

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.

5 participants