-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathe2e_test.sh
More file actions
executable file
·166 lines (137 loc) · 6 KB
/
e2e_test.sh
File metadata and controls
executable file
·166 lines (137 loc) · 6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#! /bin/bash
# Copyright 2023 Google LLC
#
# 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.
# Print commands and their arguments as they are executed.
set -x
# Exit immediately if a command exits with a non-zero status.
set -e
#details.txt file contains the release version and commit hash of the current release.
gsutil cp gs://gcsfuse-release-packages/version-detail/details.txt .
# Writing VM instance name to details.txt (Format: release-test-<os-name>)
curl http://metadata.google.internal/computeMetadata/v1/instance/name -H "Metadata-Flavor: Google" >> details.txt
# Based on the os type(from vm instance name) in detail.txt, run the following commands to add starterscriptuser
if grep -q ubuntu details.txt || grep -q debian details.txt;
then
# For ubuntu and debian os
sudo adduser --ingroup google-sudoers --disabled-password --home=/home/starterscriptuser --gecos "" starterscriptuser
else
# For rhel and centos
sudo adduser -g google-sudoers --home-dir=/home/starterscriptuser starterscriptuser
fi
# Run the following as starterscriptuser
sudo -u starterscriptuser bash -c '
# Exit immediately if a command exits with a non-zero status.
set -e
# Print commands and their arguments as they are executed.
set -x
#Copy details.txt to starterscriptuser home directory and create logs.txt
cd ~/
cp /details.txt .
touch logs.txt
echo User: $USER &>> ~/logs.txt
echo Current Working Directory: $(pwd) &>> ~/logs.txt
# Based on the os type in detail.txt, run the following commands for setup
if grep -q ubuntu details.txt || grep -q debian details.txt;
then
# For Debian and Ubuntu os
# architecture can be amd64 or arm64
architecture=$(dpkg --print-architecture)
sudo apt update
#Install fuse
sudo apt install -y fuse
# download and install gcsfuse deb package
gsutil cp gs://gcsfuse-release-packages/v$(sed -n 1p details.txt)/gcsfuse_$(sed -n 1p details.txt)_${architecture}.deb .
sudo dpkg -i gcsfuse_$(sed -n 1p details.txt)_${architecture}.deb |& tee -a ~/logs.txt
# install wget
sudo apt install -y wget
#install git
sudo apt install -y git
# install python3-setuptools tools.
sudo apt-get install -y gcc python3-dev python3-setuptools
# Downloading composite object requires integrity checking with CRC32c in gsutil.
# it requires to install crcmod.
sudo apt install -y python3-crcmod
#install build-essentials
sudo apt install -y build-essential
else
# For rhel and centos
# uname can be aarch or x86_64
uname=$(uname -i)
if [[ $uname == "x86_64" ]]; then
architecture="amd64"
elif [[ $uname == "aarch64" ]]; then
architecture="arm64"
fi
sudo yum makecache
sudo yum -y update
#Install fuse
sudo yum -y install fuse
#download and install gcsfuse rpm package
gsutil cp gs://gcsfuse-release-packages/v$(sed -n 1p details.txt)/gcsfuse-$(sed -n 1p details.txt)-1.${uname}.rpm .
sudo yum -y localinstall gcsfuse-$(sed -n 1p details.txt)-1.${uname}.rpm
#install wget
sudo yum -y install wget
#install git
sudo yum -y install git
#install Development tools
sudo yum -y install gcc gcc-c++ make
fi
# install go
wget -O go_tar.tar.gz https://go.dev/dl/go1.26.1.linux-${architecture}.tar.gz
sudo tar -C /usr/local -xzf go_tar.tar.gz
export PATH=${PATH}:/usr/local/go/bin
#Write gcsfuse and go version to log file
gcsfuse --version |& tee -a ~/logs.txt
go version |& tee -a ~/logs.txt
# Clone and checkout gcsfuse repo
export PATH=${PATH}:/usr/local/go/bin
git clone https://github.com/googlecloudplatform/gcsfuse |& tee -a ~/logs.txt
cd gcsfuse
# Installation of crcmod is working through pip only on rhel and centos.
# For debian and ubuntu, we are installing through sudo apt.
if grep -q rhel details.txt || grep -q centos details.txt;
then
# install python3-setuptools tools and python3-pip
sudo yum -y install gcc python3-devel python3-setuptools redhat-rpm-config
sudo yum -y install python3-pip
# Downloading composite object requires integrity checking with CRC32c in gsutil.
# it requires to install crcmod.
pip3 install --require-hashes -r tools/cd_scripts/requirements.txt --user
fi
git checkout $(sed -n 2p ~/details.txt) |& tee -a ~/logs.txt
#run tests with testbucket flag
set +e
# TODO: Running both tests in parallel leads to more test failures. Since Louhi runs on a smaller machine, this does not significantly reduce execution time.
# We can include this task as part of the parallel e2e test project in the Louhi pipeline.
# Run tests on HNS bucket
GODEBUG=asyncpreemptoff=1 CGO_ENABLED=0 go test ./tools/integration_tests/... -p 1 -short --integrationTest -v --testbucket=$(sed -n 3p ~/details.txt)-hns --timeout=60m &>> ~/logs-hns.txt
if [ $? -ne 0 ];
then
echo "Test failures detected" &>> ~/logs-hns.txt
else
touch success-hns.txt
gsutil cp success-hns.txt gs://gcsfuse-release-packages/v$(sed -n 1p ~/details.txt)/$(sed -n 3p ~/details.txt)/
fi
gsutil cp ~/logs-hns.txt gs://gcsfuse-release-packages/v$(sed -n 1p ~/details.txt)/$(sed -n 3p ~/details.txt)/
# Run tests on FLAT bucket
GODEBUG=asyncpreemptoff=1 CGO_ENABLED=0 go test ./tools/integration_tests/... -p 1 -short --integrationTest -v --testbucket=$(sed -n 3p ~/details.txt) --timeout=60m &>> ~/logs.txt
if [ $? -ne 0 ];
then
echo "Test failures detected" &>> ~/logs.txt
else
touch success.txt
gsutil cp success.txt gs://gcsfuse-release-packages/v$(sed -n 1p ~/details.txt)/$(sed -n 3p ~/details.txt)/
fi
gsutil cp ~/logs.txt gs://gcsfuse-release-packages/v$(sed -n 1p ~/details.txt)/$(sed -n 3p ~/details.txt)/
'