Skip to content

Commit

Permalink
separate 2 testsuit
Browse files Browse the repository at this point in the history
  • Loading branch information
anh-bolt committed Aug 15, 2024
1 parent 722c3b5 commit 538c14b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ jobs:
- name: Install and start SFTP
run: |
sudo apt install openssh-server
sudo sh -c 'echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "PasswordAuthentication no" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "UsePAM yes" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "Match User usr4ssh" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "\tPasswordAuthentication no" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "\tPermitEmptyPasswords yes" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "\tKbdInteractiveAuthentication no" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "\tPubkeyAuthentication yes" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "Match all" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "KbdInteractiveAuthentication no" >> /etc/ssh/sshd_config'
sudo systemctl enable ssh
sudo systemctl start ssh
sudo cat /etc/ssh/sshd_config
- name: Create a test user account
run: |
Expand All @@ -45,15 +53,17 @@ jobs:
echo "adding user to group ${sshGroup}"
sudo useradd -s /bin/bash -d /home/usr -m -g ${sshGroup} -p $(echo pwd | openssl passwd -1 -stdin) usr
echo "adding user for test ssh keypair to group ${sshGroup}"
sudo useradd -s /bin/bash -d /home/usr4ssh -m -g ${sshGroup} -p $(echo pwd | openssl passwd -1 -stdin) usr4ssh
ssh-keygen -t rsa -b 4096 -N "123456" -f ~/.ssh/sftptest
chmod -R 700 ~/.ssh/sftptest
chmod 600 ~/.ssh/sftptest.pub
sudo -u usr mkdir /home/usr/.ssh/
sudo cat ~/.ssh/sftptest.pub >> /home/usr/.ssh/authorized_keys
sudo chown -R usr:${sshGroup} /home/usr/.ssh
sudo chmod -R 700 /home/usr/.ssh
sudo chmod 664 /home/usr/.ssh/authorized_keys
sudo -u usr4ssh mkdir /home/usr4ssh/.ssh/
sudo cat ~/.ssh/sftptest.pub >> /home/usr4ssh/.ssh/authorized_keys
sudo chown -R usr4ssh:${sshGroup} /home/usr4ssh/.ssh
sudo chmod -R 700 /home/usr4ssh/.ssh
sudo chmod 664 /home/usr4ssh/.ssh/authorized_keys
cp ~/.ssh/sftptest ${GITHUB_WORKSPACE}/sftp-connector-test/src_test/com/axonivy/connector/sftp/test/sftptest
- name: Setup Maven
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class SftpProcessSSHTest {
@BeforeAll
public static void init() throws Exception {
String prefix = "com_axonivy_connector_sftp_server_";
// set-up var for ssh
Ivy.var().set(prefix+"username", "usr4ssh");
Ivy.var().set(prefix+"auth", "ssh");
Ivy.var().set(prefix+"password", "");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

Expand All @@ -19,6 +21,7 @@
import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess;
import ch.ivyteam.ivy.bpm.engine.client.sub.SubProcessCallResult;
import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest;
import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.scripting.objects.File;


Expand All @@ -36,7 +39,6 @@
* </p>
*/
@IvyProcessTest(enableWebServer = true)
@Disabled
public class SftpProcessTest {

private static final BpmProcess TEST_HELPER_PROCESS = BpmProcess.path("Sftp/SftpHelper");
Expand All @@ -46,7 +48,18 @@ public class SftpProcessTest {
private static final String TEST_FILE_NAME = "market_market_connector_sftp.pdf";
private static final long TEST_FILE_SIZE = 207569L;


@BeforeAll
public static void init() throws Exception {
String prefix = "com_axonivy_connector_sftp_server_";
// set-up var for ssh
Ivy.var().set(prefix+"username", "usr");
Ivy.var().set(prefix+"auth", "password");
Ivy.var().set(prefix+"password", "pwd");

Ivy.var().set(prefix+"secret_sshkey", "");
Ivy.var().set(prefix+"secret_sshpassphrase", "");
}

@Test
@Order(1)
public void callOpenConnection(BpmClient bpmClient) {
Expand Down

0 comments on commit 538c14b

Please sign in to comment.