Skip to content

Commit 0dd4c9c

Browse files
authored
chore: Init mock test for other services (#1253)
1 parent 28226e0 commit 0dd4c9c

File tree

33 files changed

+597
-4
lines changed

33 files changed

+597
-4
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,42 @@ jobs:
110110
run: |
111111
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4010:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/block-storage/v3.yaml -d
112112
113+
- name: Start prism mock server - Compute
114+
run: |
115+
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4011:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/compute/v2.yaml -d
116+
117+
- name: Start prism mock server - DNS
118+
run: |
119+
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4012:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/dns/v2.yaml -d
120+
121+
- name: Start prism mock server - Identity
122+
run: |
123+
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4013:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/identity/v3.yaml -d
124+
125+
- name: Start prism mock server - Image
126+
run: |
127+
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4014:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/image/v2.yaml -d
128+
129+
- name: Start prism mock server - Load Balancer
130+
run: |
131+
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4015:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/load-balancer/v2.yaml -d
132+
113133
- name: Start prism mock server - Network
114134
run: |
115-
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4020:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/network/v2.yaml -d
135+
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4016:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/network/v2.yaml -d
136+
137+
- name: Start prism mock server - Object Storage
138+
run: |
139+
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4017:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/object-store/v1.yaml -d
116140
117141
- name: Run tests
118142
env:
119143
OPENSTACK_BLOCK_STORAGE_ENDPOINT: http://localhost:4010/v3
120-
OPENSTACK_NETWORK_ENDPOINT: http://localhost:4020/v2.0
144+
OPENSTACK_COMPUTE_ENDPOINT: http://localhost:4011/v2.1
145+
OPENSTACK_DNS_ENDPOINT: http://localhost:4012/v2
146+
OPENSTACK_IDENTITY_ENDPOINT: http://localhost:4013/v3
147+
OPENSTACK_IMAGE_ENDPOINT: http://localhost:4014/v2
148+
OPENSTACK_LOAD_BALANCER_ENDPOINT: http://localhost:4015/v2
149+
OPENSTACK_NETWORK_ENDPOINT: http://localhost:4016/v2.0
150+
OPENSTACK_OBJECT_STORE_ENDPOINT: http://localhost:4017/v1
121151
run: cargo test -p openstack_types --test mocked

openstack_types/tests/mocked/compute/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
// limitations under the License.
1212
//
1313
// SPDX-License-Identifier: Apache-2.0
14+
15+
mod v2;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
//
13+
// SPDX-License-Identifier: Apache-2.0
14+
15+
mod server;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
//
13+
// SPDX-License-Identifier: Apache-2.0
14+
15+
mod response;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
//
13+
// SPDX-License-Identifier: Apache-2.0
14+
15+
use openstack_sdk::api::compute::v2::server::list::Request;
16+
use openstack_sdk::api::{paged, Pagination, QueryAsync};
17+
use openstack_types::compute::v2::server::response::list::ServerResponse;
18+
19+
use crate::get_client;
20+
21+
#[tokio::test]
22+
async fn deserialize() -> Result<(), Box<dyn std::error::Error>> {
23+
let client = get_client("compute");
24+
25+
let _res: Vec<ServerResponse> = paged(Request::builder().build()?, Pagination::Limit(10))
26+
.query_async(&client)
27+
.await?;
28+
29+
Ok(())
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
//
13+
// SPDX-License-Identifier: Apache-2.0
14+
15+
use openstack_sdk::api::compute::v2::server::list_detailed::Request;
16+
use openstack_sdk::api::{paged, Pagination, QueryAsync};
17+
use openstack_types::compute::v2::server::response::list_detailed::ServerResponse;
18+
19+
use crate::get_client;
20+
21+
#[tokio::test]
22+
async fn deserialize() -> Result<(), Box<dyn std::error::Error>> {
23+
let client = get_client("compute");
24+
25+
let _res: Vec<ServerResponse> = paged(Request::builder().build()?, Pagination::Limit(10))
26+
.query_async(&client)
27+
.await?;
28+
29+
Ok(())
30+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
//
13+
// SPDX-License-Identifier: Apache-2.0
14+
15+
mod list;
16+
mod list_detailed;

openstack_types/tests/mocked/dns/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
// limitations under the License.
1212
//
1313
// SPDX-License-Identifier: Apache-2.0
14+
15+
mod v2;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
//
13+
// SPDX-License-Identifier: Apache-2.0
14+
15+
mod zone;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
//
13+
// SPDX-License-Identifier: Apache-2.0
14+
15+
mod response;

0 commit comments

Comments
 (0)