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

feat(modelarts): add resource to operate devserver #6098

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

wuzhuanhong
Copy link
Contributor

What this PR does / why we need it:

Add new resource to start or stop DevService.

Which issue this PR fixes:
(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)
fixes #xxx

Special notes for your reviewer:

Release note:

1. add new resource to operate DevService.
2. add related document and accptance test.

PR Checklist

  • Tests added/passed.
 ./scripts/coverage.sh -o modelarts -f TestAccDevServer_basic
Prepare to calculate the coverage the following command:
TF_ACC=1 go test "./huaweicloud/services/acceptance/modelarts" -v -coverprofile="./huaweicloud/services/acceptance/modelarts/modelarts_coverage.cov" -coverpkg="./huaweicloud/services/modelarts" -run TestAccDevServer_basic -timeout 360m -parallel 10
=== RUN   TestAccDevServer_basic
=== PAUSE TestAccDevServer_basic
=== CONT  TestAccDevServer_basic
--- PASS: TestAccDevServer_basic (433.24s)
PASS
coverage: 10.1% of statements in ./huaweicloud/services/modelarts
ok      github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance/modelarts 433.329s        coverage: 10.1% of statements in ./huaweicloud/services/modelarts
  • Documentation updated.

  • Schema updated.

  • CheckDeleted.

    • a. During query operation (Read Context)
      aa. Resource not found
      >>>>>> Paste the screenshot here <<<<<<

    • b. During delete/disassociate/unbind operation (Delete Context)
      ba. Resource not found
      >>>>>> Paste the screenshot here <<<<<<

@wuzhuanhong
Copy link
Contributor Author

./scripts/coverage.sh -o modelarts -f TestAccDevServer_basic
Prepare to calculate the coverage the following command:
TF_ACC=1 go test "./huaweicloud/services/acceptance/modelarts" -v -coverprofile="./huaweicloud/services/acceptance/modelarts/modelarts_coverage.cov" -coverpkg="./huaweicloud/services/modelarts" -run TestAccDevServer_basic -timeout 360m -parallel 10
=== RUN TestAccDevServer_basic
=== PAUSE TestAccDevServer_basic
=== CONT TestAccDevServer_basic
--- PASS: TestAccDevServer_basic (513.42s)
PASS
coverage: 10.1% of statements in ./huaweicloud/services/modelarts
ok github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance/modelarts 513.504s coverage: 10.1% of statements in ./huaweicloud/services/modelarts

@@ -88,7 +106,7 @@ func TestAccDevServer_basic(t *testing.T) {
})
}

func testDevServer_basic(name, password string, autoRenew bool) string {
func testDevServer_basic_step1(name, password string, autoRenew bool) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename it as the testAccDevServer_basic and using these references as follows:

// Rename the argument input 'autoRenew' as the 'isAutoRenew', and put it ahead of the other string arguments.
func testAccDevServer_basic(isAutoRenew bool, name, password string) string {
  return testAccDevServer_base(isAutoRenew, name, password)
}

return testDevServer_basic_step1(name, password, autoRenew)
}

func testDevServer_basic_step3(name, password string, autoRenew bool) string {
Copy link
Contributor

@Lance52259 Lance52259 Dec 30, 2024

Choose a reason for hiding this comment

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

testAccDevServer_doAction(isAutoRenew bool, name, password string, actionType string, doRetryAction bool) string {
    return fmt.Sprintf(`
%[1]s

resource "huaweicloud_modelarts_devserver_action" "test" {
  devserver_id = huaweicloud_modelarts_devserver.test.id
  action       = "%[2]s"
}

variable "is_retry_devserver_action" {
  type    = bool
  default = %[3]s
}

resource "huaweicloud_modelarts_devserver_action" "retry" {
  count = var.is_retry_devserver_action ? 1 : 0

  depends_on = [huaweicloud_modelarts_devserver_action.test]

  devserver_id = huaweicloud_modelarts_devserver.test.id
  action       = "%[2]s"
}
`, testAccDevServer_basic(sAutoRenew, name, password), actionType, doRetryAction)
}

// step 3 to 6 are using it

Comment on lines 37 to 38
+ **start**: The DevServer can be started only when the DevServers is stopped, fails to stop, or fails to start.
+ **stop**: The DevServer can be stopped only when it is running or stop failure.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
+ **start**: The DevServer can be started only when the DevServers is stopped, fails to stop, or fails to start.
+ **stop**: The DevServer can be stopped only when it is running or stop failure.
+ **start**: The DevServer can be started only when the DevServers is stopped, stop failure, or start failure.
+ **stop**: The DevServer can be stopped only when it is running or stop failure.

@wuzhuanhong
Copy link
Contributor Author

./scripts/coverage.sh -o modelarts -f TestAccDevServer_basic
Prepare to calculate the coverage the following command:
TF_ACC=1 go test "./huaweicloud/services/acceptance/modelarts" -v -coverprofile="./huaweicloud/services/acceptance/modelarts/modelarts_coverage.cov" -coverpkg="./huaweicloud/services/modelarts" -run TestAccDevServer_basic -timeout 360m -parallel 10
=== RUN TestAccDevServer_basic
=== PAUSE TestAccDevServer_basic
=== CONT TestAccDevServer_basic
--- PASS: TestAccDevServer_basic (504.73s)
PASS
coverage: 10.1% of statements in ./huaweicloud/services/modelarts
ok github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance/modelarts 504.817s coverage: 10.1% of statements in ./huaweicloud/services/modelarts

@wuzhuanhong
Copy link
Contributor Author

./scripts/coverage.sh -o modelarts -f TestAccDevServer_basic
Prepare to calculate the coverage the following command:
TF_ACC=1 go test "./huaweicloud/services/acceptance/modelarts" -v -coverprofile="./huaweicloud/services/acceptance/modelarts/modelarts_coverage.cov" -coverpkg="./huaweicloud/services/modelarts" -run TestAccDevServer_basic -timeout 360m -parallel 10
=== RUN TestAccDevServer_basic
=== PAUSE TestAccDevServer_basic
=== CONT TestAccDevServer_basic
--- PASS: TestAccDevServer_basic (446.74s)
PASS
coverage: 10.1% of statements in ./huaweicloud/services/modelarts
ok github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance/modelarts 446.849s coverage: 10.1% of statements in ./huaweicloud/services/modelarts

@Lance52259
Copy link
Contributor

/approve
/lgtm

@github-ci-robot github-ci-robot added LGTM /lgtm approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 30, 2024
Copy link
Collaborator

@github-ci-robot github-ci-robot left a comment

Choose a reason for hiding this comment

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

This PR has been approved by: @Lance52259

/approve
/lgtm

@github-ci-robot github-ci-robot merged commit 4a95599 into huaweicloud:master Dec 30, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. feature LGTM /lgtm size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants