Skip to content

Commit 72e8e58

Browse files
Free up disk space for integration test (datafusion-contrib#179)
* Free up disk space for integration test (datafusion-contrib#171) * Drop postgres containers once test is finished * Add step to free disk space in integration test job * update * Fix MySQL test (datafusion-contrib#181) * Increase the waiting time for starting MySQL test container * Update health check command --------- Co-authored-by: Qianqian <130200611+Sevenannn@users.noreply.github.com>
1 parent 8dbae51 commit 72e8e58

3 files changed

Lines changed: 46 additions & 3 deletions

File tree

.github/workflows/pr.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,34 @@ jobs:
7171
docker pull ${{ env.PG_DOCKER_IMAGE }}
7272
docker pull ${{ env.MYSQL_DOCKER_IMAGE }}
7373
74+
- name: Free Disk Space
75+
run: |
76+
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
77+
sudo rm -rf \
78+
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
79+
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
80+
/usr/lib/jvm || true
81+
echo "some directories deleted"
82+
sudo apt install aptitude -y >/dev/null 2>&1
83+
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
84+
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
85+
google-cloud-sdk imagemagick \
86+
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
87+
mercurial apt-transport-https mono-complete libmysqlclient \
88+
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
89+
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
90+
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
91+
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
92+
-y -f >/dev/null 2>&1
93+
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
94+
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
95+
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
96+
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
97+
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
98+
sudo apt-get autoremove -y >/dev/null 2>&1
99+
sudo apt-get autoclean -y >/dev/null 2>&1
100+
echo "some packages purged"
101+
df -h
102+
74103
- name: Run tests
75104
run: make test

tests/mysql/common.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ pub async fn start_mysql_docker_container(port: usize) -> Result<RunningContaine
5858
.healthcheck(HealthConfig {
5959
test: Some(vec![
6060
"CMD-SHELL".to_string(),
61-
format!("mysqladmin ping --password={MYSQL_ROOT_PASSWORD}"),
61+
format!(
62+
"mysqladmin ping --host=127.0.0.1 --port=3306 --password={MYSQL_ROOT_PASSWORD}"
63+
),
6264
]),
63-
interval: Some(250_000_000), // 250ms
65+
interval: Some(500_000_000), // 250ms
6466
timeout: Some(100_000_000), // 100ms
6567
retries: Some(5),
6668
start_period: Some(500_000_000), // 100ms
@@ -70,7 +72,7 @@ pub async fn start_mysql_docker_container(port: usize) -> Result<RunningContaine
7072
.run()
7173
.await?;
7274

73-
tokio::time::sleep(std::time::Duration::from_millis(5000)).await;
75+
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
7476
Ok(running_container)
7577
}
7678

tests/postgres/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ struct ContainerManager {
101101
claimed: bool,
102102
}
103103

104+
impl Drop for ContainerManager {
105+
fn drop(&mut self) {
106+
let _ = tokio::runtime::Runtime::new()
107+
.unwrap()
108+
.block_on(stop_container(self.port));
109+
}
110+
}
111+
112+
async fn stop_container(port: usize) {
113+
println!("Stopping Postgres container on port {}", port);
114+
}
115+
104116
#[fixture]
105117
#[once]
106118
fn container_manager() -> Mutex<ContainerManager> {

0 commit comments

Comments
 (0)