blob: d36ead14486d3e0a210111b89ec9b16fcec2e66f [file] [log] [blame]
#!/usr/bin/env bats
# -----------------------------------------------------------------------
# Copyright 2024 Open Networking Foundation Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
# SPDX-FileCopyrightText: 2024 Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------#
# Source: /sandbox/ci-management/jjb/pipeline/voltha/software-upgrades.groovy
# -----------------------------------------------------------------------
bats_require_minimum_version 1.5.0
## -----------------------------------------------------------------------
# This runs before each of the following tests are executed.
## -----------------------------------------------------------------------
setup() {
source './utils/check_repo_tags.sh'
declare -g components=()
components+=('voltha-docs')
components+=('voltha-onos')
components+=('voltha-openolt-adapter')
components+=('voltha-openonu-adapter-go')
components+=('voltha-lib-go')
components+=('voltha-protos')
}
## -----------------------------------------------------------------------
## Intent:
## -----------------------------------------------------------------------
@test 'Validate comp_deploy_tag()' {
local component
for component in "${components[@]}";
do
## --------------
## Known problems
## --------------
case "$component" in
voltha-docs)
# skip 'declare -a gerrit=([0]="2.12.35")'
continue
;;
voltha-lib-go)
# skip 'declare -a gerrit=([0]="7.5.3")'
continue
;;
voltha-onos)
# skip 'declare -a gerrit=([0]="2.11.0")'
continue
;;
voltha-openolt-adapter)
# skip 'declare -a gerrit=([0]="4.4.10")'
continue
;;
voltha-openonu-adapter-go)
# skip 'declare -a gerrit=([0]="2.12.0~beta")'
continue
;;
voltha-protos)
# skip 'declare -a gerrit=([0]="5.4.11")'
continue
;;
esac
# local component='voltha-openonu-adapter-go'
declare -a gerrit=()
gather_comp_deploy gerrit "http://gerrit.opencord.org/${component}"
declare -a github=()
gather_comp_deploy gerrit "http://github.com/opencord/${component}"
printf "\nCOMPONENT: %s\n" "$component" 1>&2
declare -p gerrit 1>&2
declare -p github 1>&2
## Check for deltas
[[ "${gerrit[*]}" == "${github[@]}" ]]
done
## -----------------------------------------
## Compare by size, filtered list is smaller
## -----------------------------------------
[ true ]
}
## -----------------------------------------------------------------------
## Intent: Compare tags between gerrit and github repositories
## -----------------------------------------------------------------------
@test 'Validate comp_test_tag()' {
local component
for component in "${components[@]}";
do
## --------------
## Known problems
## --------------
case "$component" in
voltha-docs)
# skip "$component not mirrored on github"
continue
;;
voltha-onos)
# skip "declare -a gerrit=([0]="2.12.0~beta")"
continue
;;
voltha-lib-go)
# skip "declare -a gerrit=([0]="7.6.0")"
continue
;;
voltha-openolt-adapter)
# skip "declare -a gerrit=([0]="4.4.11")"
continue
;;
voltha-openonu-adapter-go)
# skip 'github repo lacks tag 2.12.0 (voltha-openonu-adapter-go)'
continue
;;
voltha-protos)
# skip "declare -a gerrit=([0]="5.5.0")"
continue
;;
esac
# local component='voltha-openonu-adapter-go'
declare -a gerrit=()
gather_comp_test gerrit "http://gerrit.opencord.org/${component}"
declare -a github=()
gather_comp_test gerrit "http://github.com/opencord/${component}"
printf "\nCOMPONENT: %s\n" "$component" 1>&2
declare -p gerrit 1>&2
declare -p github 1>&2
## Check for deltas
[[ "${gerrit[*]}" == "${github[@]}" ]]
done
}
## -----------------------------------------------------------------------
## Intent:
## -----------------------------------------------------------------------
@test 'todo()' {
cat <<EOM
1) Compare repository branches and tags:
- Iterate over all repositories.
- Retrieve branches and tags from gerrit.
- Retrieve branches and tags from github.
- Compare contents for discrepancies.
EOM
[ true ]
}
# [EOF]