Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#18723 from CodingCookieRookie/test-empty-cred…
…entials-ddl-support juju#18723 This PR enhances the test coverage for scenarios involving empty credentials in the model handling logic. The v_model view build a lot of information about a model’s credential that is done with a left join. We need a test to assert that when the credential is null in the database the model and it’s credential information correctly come back out of the v_model view.. ## Checklist ~~- [ ] Code style: imports ordered, good names, simple structure, etc~~ ~~- [ ] Comments saying why design decisions were made~~ ~~- [ ] [Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing~~ ~~- [ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~~ - [x] Go unit tests, with comments saying what you're testing ## Unit test steps 1. From project directory, go to domain/model/state folder ```sh cd domain/model/state ``` 2. Run unit tests in the directory ```sh go test -v . ``` ## QA steps 1. Finds ubuntu AMI ```sh aws ec2 describe-images \n --owners 099720109477 \n --filters "Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-jammy-?????-amd64-server-????????" 'Name=state,Values=available' \n --query 'reverse(sort_by(Images, &CreationDate))[:1].ImageId' --output text instance_image_id=ami-0e1bed4f06a3b463d ``` 2. Create VPC ```sh aws ec2 create-vpc --cidr-block 10.0.0.0/28 \n --query 'Vpc.VpcId' --tag-specifications 'ResourceType=vpc,Tags=[{Key=Name,Value=manual-deploy}]' --output text vpc_id = vpc-0432dbe7ec058d2c0 ``` 3. Creates internet gateway ```sh aws ec2 create-internet-gateway --query 'InternetGateway.InternetGatewayId' --output text igw_id=igw-0d37d1d8126377401 ``` 4. Attach internet gateway with vac ```sh aws ec2 attach-internet-gateway --internet-gateway-id "${igw_id}" --vpc-id "${vpc_id}" ``` 5. Create subnet ```sh aws ec2 create-subnet --vpc-id "${vpc_id}" --cidr-block 10.0.0.0/28 --query 'Subnet.SubnetId' --output text subnet_id=subnet-0914fd19b516578fb ``` 6. Create security group ```sh aws ec2 create-security-group --group-name "ci-manual-deploy" --description "run_deploy_manual_aws" --vpc-id "${vpc_id}" --query 'GroupId' --output text sg_id=sg-07061ccc27117a995 ``` 7. Run instance ```sh aws ec2 run-instances --image-id "${instance_image_id}" --count 1 --instance-type t2.medium --associate-public-ip-address --tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=alvincontroller}]" --key-name "testkeypair2" --subnet-id "${subnet_id}" --security-group-ids "${sg_id}" --query 'Instances[0].InstanceId' --output text instance_id=i-03c45a50f959c29b4 ``` 8. Query instance for public ip ```sh aws ec2 describe-instances --instance-ids "${instance_id}" \n --query 'Reservations[0].Instances[0].PublicIpAddress' \n --output text ``` Output: 3.93.217.117 9. Add a yaml file for manual cloud in user directory ```sh cd ~ echo "clouds: alvin-cloud: type: manual endpoint: [email protected] regions: default: endpoint: [email protected]" > mycloud.yaml ``` 10. Bootstrap a manual controller ```sh juju bootstrap alvin-cloud test-alvin ``` 12. Check credential information for manual controller in dqlite ```sh juju ssh 0 sudo /var/lib/juju/tools/machine-0/jujud db-repl --machine-id 0 select prdesc from model ``` ## Links **Jira card:** https://warthogs.atlassian.net/browse/JUJU-7395
- Loading branch information