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

Ricochet 2 #425

Merged
merged 8 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/others_testacc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: local tests
run: |
wget https://github.com/outscale/osc-ricochet-2/releases/download/v0.2.0/osc-ricochet-2_v0.2.0_x86_64-unknown-linux-musl.tar.gz
tar -xvf osc-ricochet-2_v0.2.0_x86_64-unknown-linux-musl.tar.gz
./ricochet-2 ./ricochet.json &
make test-locally

- name: Build go test
run: make test
env:
Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,19 @@ $ export OUTSCALE_ACCOUNT="<ACCOUNTPID>" # i.e. "XXXXXXXXXXXX"
```sh
$ make testacc
```

If you want, you can tests terraform locally using [ricochet-2](https://github.com/outscale/osc-ricochet-2/)
to do so, you need to get ricochet-2 [release](https://github.com/outscale/osc-ricochet-2/tags)
extract and start it:
```
tar -xvf osc-ricochet-2_v0.2.0_x86_64-unknown-linux-musl.tar.gz
./ricochet-2 ./ricochet.json
```
and in another terminal, either call `make test-locally`, or call the script manually
```
# if you want TestAccVM_withFlexibleGpuLink_basic
scripts/local-test.sh TestAccVM_withFlexibleGpuLink_basic
```

Note that ricochet-2 been fearly new, doesn't support all Outscale Calls, and some tests will fails.
Also ricochet-2 work only on Linux for now.
6 changes: 6 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ test-others: fmtcheck test-gen-cert

.PHONY: fmt
fmt:
gofmt -s -w ./utils/
gofmt -s -w ./main.go
gofmt -s -w ./$(PKG_NAME)

Expand All @@ -60,6 +61,11 @@ test-compile:
fi
go test -c $(TEST) $(TESTARGS)

.PHONY: test-locally
test-locally:
"$(CURDIR)/scripts/local-test.sh" TestAccOthers_Volume_io1Type
"$(CURDIR)/scripts/local-test.sh" TestAccVM_withFlexibleGpuLink_basic

.PHONY: test-examples
test-examples:
@sh -c "'$(CURDIR)/scripts/test-examples.sh'"
Expand Down
3 changes: 2 additions & 1 deletion outscale/resource_outscale_flexible_gpu_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ func resourceOutscaleOAPIFlexibleGpuLinkDelete(d *schema.ResourceData, meta inte
if len(*resp.FlexibleGpus) != 1 {
return fmt.Errorf("Unable to find Flexible GPU")
}
if (*resp.FlexibleGpus)[0].GetState() != "detaching" {
if (*resp.FlexibleGpus)[0].GetState() != "detaching" &&
(*resp.FlexibleGpus)[0].GetState() != "allocated" {
return fmt.Errorf("Unable to unlink Flexible GPU")
}
}
Expand Down
2 changes: 1 addition & 1 deletion outscale/resource_outscale_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func test_IO1VolumeTypeConfig(region string) string {
return fmt.Sprintf(`
resource "outscale_volume" "test-io1" {
subregion_name = "%sa"
volume_type = "gp2"
volume_type = "io1"
size = 10
iops = 100
}
Expand Down
15 changes: 15 additions & 0 deletions scripts/local-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

export TEST_QUOTA="true"
export IS_IO1_TEST_QUOTA="true"
export OSC_ENDPOINT_API="http://127.0.0.1:3000"
export OUTSCALE_SECRETKEYID="0000001111112222223333334444445555555666"
export OUTSCALE_ACCESSKEYID="11112211111110000000"
export OSC_ACCESS_KEY="11112211111110000000"
export OUTSCALE_REGION="eu-west-2"
export OUTSCALE_IMAGEID="ami-ffffff00"
export OUTSCALE_ACCOUNT="00000000"
export OUTSCALE_KEYPAIR="my_craft"

set -e
TF_LOG=DEBUG make testacc TESTARGS="-run=$1"
Loading