Skip to content

Commit 9f581ed

Browse files
authored
Add CATS job to integration tests [main] (#3023)
* Integrate CATS in Integration tests workflow Upload latest CAPI release * Remove unwanted inputs
1 parent bbb49ad commit 9f581ed

File tree

3 files changed

+155
-41
lines changed

3 files changed

+155
-41
lines changed

.github/workflows/tests-integration-reusable.yml

Lines changed: 122 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ on:
2828
pool-namespace:
2929
type: string
3030
default: 'official'
31+
3132
jobs:
3233
run-integration-tests:
3334
defaults:
@@ -47,6 +48,13 @@ jobs:
4748
repository: cloudfoundry/cli-ci
4849
path: cli-ci
4950

51+
- name: Checkout cf-acceptance-tests
52+
uses: actions/checkout@v4
53+
with:
54+
repository: cloudfoundry/cf-acceptance-tests
55+
ref: release-candidate
56+
path: cf-acceptance-tests
57+
5058
- id: read-min-capi
5159
name: Read MIN CAPI
5260
run: |
@@ -109,8 +117,16 @@ jobs:
109117
cat metadata.json | jq -r '.name'
110118
echo "lease-id=$lease_id" >> "${GITHUB_OUTPUT}"
111119
120+
- name: Set Up Go
121+
uses: actions/setup-go@v5
122+
with:
123+
go-version-file: go.mod
124+
check-latest: true
125+
112126
- name: Install Tools
113127
run: |
128+
go version
129+
114130
if [[ ${{ inputs.os }} =~ "windows" ]]
115131
then
116132
install_location=/usr/bin
@@ -138,7 +154,19 @@ jobs:
138154
credhub --version
139155
140156
apt-get update
141-
apt-get install -y build-essential
157+
apt-get install -y build-essential unzip
158+
159+
- name: Upload latest CAPI release
160+
if: ${{ inputs.capi-version == 'edge' }}
161+
run: |
162+
capi_release_version=$(curl -s https://api.github.com/repos/cloudfoundry/capi-release/releases/latest | jq -r .tag_name)
163+
echo "Latest CAPI release is $capi_release_version"
164+
165+
eval "$(bbl print-env --metadata-file metadata.json)"
166+
env_name=$(jq -r .name metadata.json)
167+
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv
168+
169+
bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version"
142170
143171
- name: Deploy Isolation Segment and OIDC Provider
144172
if: ${{ inputs.capi-version == 'edge' }}
@@ -151,7 +179,9 @@ jobs:
151179
bosh -d cf manifest > /tmp/manifest.yml
152180
bosh interpolate /tmp/manifest.yml \
153181
-o .github/ops-files/use-cflinuxfs3.yml \
182+
-o cf-deployment/operations/use-internal-lookup-for-route-services.yml \
154183
-o cf-deployment/operations/add-persistent-isolation-segment-diego-cell.yml \
184+
-o cli-ci/ci/infrastructure/operations/use-latest-capi.yml \
155185
-o cli-ci/ci/infrastructure/operations/add-oidc-provider.yml \
156186
-o cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml \
157187
-o cli-ci/ci/infrastructure/operations/diego-cell-instances.yml \
@@ -184,14 +214,99 @@ jobs:
184214
echo "Deployed CAPI version:"
185215
bosh -d cf releases | grep capi
186216
187-
- name: Set Up Go
188-
uses: actions/setup-go@v5
189-
with:
190-
go-version-file: go.mod
191-
check-latest: true
217+
- name: Add CATS config
218+
if: ${{ inputs.name == 'cats' }}
219+
run: |
220+
set -eu
221+
222+
ENV=$(jq -r .name metadata.json)
223+
API="$(jq -r .cf.api_url metadata.json)"
224+
DOMAIN=$(echo $API | sed "s/^api\.//")
225+
CF_INT_USERNAME="admin"
226+
227+
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${ENV}.priv
228+
eval "$(bbl print-env --metadata-file ./metadata.json)"
229+
230+
credhub login
231+
CF_INT_PASSWORD=$(credhub get -n /bosh-$ENV/cf/cf_admin_password | bosh interpolate --path /value -)
232+
233+
cat << EOF | jq -S . > cats_config.json
234+
{
235+
"admin_password": "${CF_INT_PASSWORD}",
236+
"admin_user": "${CF_INT_USERNAME}",
237+
"api": "${API}",
238+
"apps_domain": "${DOMAIN}",
239+
"backend" : "diego",
240+
"broker_start_timeout": 330,
241+
"cf_push_timeout": 210,
242+
"default_timeout": 120,
243+
"long_curl_timeout": 210,
244+
"skip_ssl_validation": true,
245+
"use_http": true,
246+
"include_apps": true,
247+
"include_backend_compatibility": false,
248+
"include_container_networking": true,
249+
"include_detect": true,
250+
"include_docker": true,
251+
"include_internet_dependent": true,
252+
"include_isolation_segments": true,
253+
"isolation_segment_name": "persistent_isolation_segment",
254+
"include_private_docker_registry": false,
255+
"include_route_services": true,
256+
"include_routing": true,
257+
"include_routing_isolation_segments": false,
258+
"include_security_groups": true,
259+
"include_services": true,
260+
"include_service_discovery": true,
261+
"include_service_instance_sharing": true,
262+
"include_ssh": true,
263+
"include_sso": false,
264+
"include_tasks": true,
265+
"include_tcp_routing": true,
266+
"include_v3": true,
267+
"include_zipkin": true
268+
}
269+
EOF
270+
271+
make build
272+
echo "$PWD/out" >> $GITHUB_PATH
273+
export PATH="$PWD/out:$PATH"
274+
cf version
275+
276+
export CF_USERNAME=${CF_INT_USERNAME}
277+
export CF_PASSWORD=${CF_INT_PASSWORD}
278+
cf api ${API} --skip-ssl-validation
279+
cf auth
280+
cf enable-feature-flag diego_docker
281+
cf enable-feature-flag service_instance_sharing
282+
283+
- name: Run CATS Tests
284+
if: ${{ inputs.name == 'cats' }}
285+
run: |
286+
set -xeu
287+
288+
export CONFIG
289+
CONFIG=$(mktemp)
290+
291+
original_config="${PWD}/cats_config.json"
292+
cp ${original_config} ${CONFIG}
293+
294+
cd ./cf-acceptance-tests
295+
export CF_DIAL_TIMEOUT=11
296+
export CF_PLUGIN_HOME=$HOME
297+
go version
298+
299+
./bin/test \
300+
--keep-going \
301+
--randomize-all \
302+
--skip-package=helpers \
303+
--nodes="12" \
304+
--flake-attempts=2 \
305+
--timeout="2h" \
306+
--no-color
192307
193308
- name: Run Integration Tests
194-
if: ${{ !inputs.run-with-client-creds }}
309+
if: ${{ !inputs.run-with-client-creds && inputs.name != 'cats' }}
195310
run: |
196311
ENV=$(cat metadata.json | jq -r '.name')
197312
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${ENV}.priv

.github/workflows/tests-integration.yml

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ on:
1717
options:
1818
- run-integration-tests-cf-env
1919
- run-integration-tests-cf-env-with-client-creds
20-
- run-integration-tests-cf-env-with-min-capi
21-
# - run-integration-windows
22-
# - run-integration-windows-client-credentials
20+
# - run-integration-tests-cf-env-with-min-capi
21+
- run-cats-cf-env
22+
workflow_run:
23+
workflows:
24+
- "Tests"
25+
types:
26+
- completed
27+
2328
jobs:
2429
run-integration-tests-cf-env:
2530
name: Integration tests
@@ -43,37 +48,31 @@ jobs:
4348
name: Integration client creds
4449
secrets: inherit
4550

46-
run-integration-tests-cf-env-with-min-capi:
47-
name: MIN CAPI
48-
if: ${{ inputs.workflow == 'all' || inputs.workflow == 'run-integration-tests-cf-env-with-min-capi' }}
51+
# run-integration-tests-cf-env-with-min-capi:
52+
# name: MIN CAPI
53+
# if: ${{ inputs.workflow == 'all' || inputs.workflow == 'run-integration-tests-cf-env-with-min-capi' }}
54+
# uses: ./.github/workflows/tests-integration-reusable.yml
55+
# with:
56+
# capi-version: min
57+
# run-with-client-creds: false
58+
# os: ubuntu-latest
59+
# name: Integration MIN CAPI
60+
# pool-name: cfd_16_11_0
61+
# pool-namespace: tas-devex
62+
# is-pr: ${{ github.event_name != 'workflow_dispatch' }}
63+
# secrets: inherit
64+
65+
run-cats-cf-env:
66+
name: CATS
67+
needs:
68+
- run-integration-tests-cf-env
69+
- run-integration-tests-cf-env-with-client-creds
70+
if: ${{ inputs.workflow == 'all' || inputs.workflow == 'run-cats-cf-env' }}
4971
uses: ./.github/workflows/tests-integration-reusable.yml
5072
with:
51-
capi-version: min
73+
capi-version: edge
5274
run-with-client-creds: false
5375
os: ubuntu-latest
54-
name: Integration MIN CAPI
55-
pool-name: cfd_16_11_0
56-
pool-namespace: tas-devex
57-
secrets: inherit
58-
59-
#run-integration-windows:
60-
# name: Windows
61-
# if: ${{ inputs.workflow == 'all' || inputs.workflow == 'run-integration-windows' }}
62-
# uses: ./.github/workflows/tests-integration-reusable.yml
63-
# with:
64-
# capi-version: edge
65-
# run-with-client-creds: false
66-
# os: windows-latest
67-
# name: Integration windows
68-
# secrets: inherit
69-
70-
#run-integration-windows-client-credentials:
71-
# name: Windows with client credentials
72-
# if: ${{ inputs.workflow == 'all' || inputs.workflow == 'run-integration-windows-client-credentials' }}
73-
# uses: ./.github/workflows/tests-integration-reusable.yml
74-
# with:
75-
# capi-version: edge
76-
# run-with-client-creds: true
77-
# os: windows-latest
78-
# name: Integration windows client credentials
79-
# secrets: inherit
76+
name: cats
77+
is-pr: ${{ github.event_name != 'workflow_dispatch' }}
78+
secrets: inherit

integration/shared/isolated/error_handling_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
var _ = Describe("curl command", func() {
1212
It("returns the expected request", func() {
1313
session := helpers.CF("curl", "/v2/banana")
14-
Eventually(session).Should(Say(`"error_code": "CF-NotFound"`))
14+
Eventually(session).Should(Say(`"error_code":"CF-NotFound"`))
1515
Eventually(session).Should(Exit(0))
1616
})
1717

0 commit comments

Comments
 (0)