Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging: Add vagrant tests for windows service #33729

Merged
merged 48 commits into from
Nov 29, 2018
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4931386
Tests: Add vagrant tests for windows service
rjernst Sep 14, 2018
e413237
Merge branch 'master' into launcher2
rjernst Sep 15, 2018
ae2b790
remove debug printout
rjernst Sep 16, 2018
8fdbe43
add windows assumption
rjernst Sep 16, 2018
4f65726
Merge branch 'master' into launcher2
rjernst Sep 18, 2018
a31cfe4
address PR feedback
rjernst Sep 18, 2018
d4e6a3a
Merge branch 'master' into launcher2
rjernst Sep 20, 2018
3201906
Merge branch 'master' into launcher2
rjernst Sep 20, 2018
afcebe8
remove unused import
rjernst Sep 20, 2018
53a113b
Merge branch 'master' into launcher2
rjernst Sep 25, 2018
05599a8
Merge branch 'master' into launcher2
rjernst Sep 25, 2018
1bd94fb
Merge branch 'master' into launcher2
rjernst Sep 26, 2018
455bce3
Merge branch 'master' into launcher2
rjernst Sep 26, 2018
fe80a4e
Merge branch 'master' into launcher2
rjernst Sep 28, 2018
8873493
test debugging improvements
rjernst Sep 28, 2018
51d3da4
Merge branch 'master' into launcher2
rjernst Oct 17, 2018
0f0ef8c
Merge branch 'master' into launcher2
rjernst Oct 23, 2018
50b5e93
Merge branch 'master' into launcher2
rjernst Oct 30, 2018
fd817f7
make service start/stop test use service checks
rjernst Oct 31, 2018
c4e2aaa
fix tests, works with updated apache procrun exes
rjernst Oct 31, 2018
af129d9
Packaging: Update procrun executables to version 1.1.0
rjernst Oct 31, 2018
6c008e3
Merge branch 'master' into launcher2
rjernst Oct 31, 2018
67fb60f
Merge branch 'procrun1.1' into launcher2
rjernst Oct 31, 2018
048c886
Merge branch 'master' into launcher2
rjernst Nov 14, 2018
a0d1244
add debugging stuff
rjernst Nov 15, 2018
c557f23
use logger
rjernst Nov 15, 2018
68d9630
loop waiting on mystery process
rjernst Nov 15, 2018
1467f94
try blanket sleep...
rjernst Nov 16, 2018
87e1d81
Merge branch 'master' into launcher2
rjernst Nov 16, 2018
d183e01
Merge branch 'master' into launcher2
rjernst Nov 21, 2018
905ba7e
temporarily add procdump to get info about lingering process
rjernst Nov 21, 2018
3f09765
Merge branch 'master' into launcher2
rjernst Nov 21, 2018
6b916f9
try different flags
rjernst Nov 26, 2018
00c461c
Merge branch 'master' into launcher2
rjernst Nov 26, 2018
bd9fe9c
no process copy...
rjernst Nov 26, 2018
e8ac487
try using sc exe
rjernst Nov 27, 2018
8d8bb6f
"better" logging...
rjernst Nov 27, 2018
495aa2d
turn procdump back on
rjernst Nov 27, 2018
d232738
Merge branch 'master' into launcher2
rjernst Nov 28, 2018
cb1393d
more debugging
rjernst Nov 28, 2018
97e3476
Revert "Packaging: Update procrun executables to version 1.1.0 (#35147)"
rjernst Nov 28, 2018
2a5c166
isolate windows tests and sleep waiting for zombie
rjernst Nov 29, 2018
214fa2c
reenable other tests
rjernst Nov 29, 2018
1ab5391
cleanup
rjernst Nov 29, 2018
66dae62
Revert "Revert "Packaging: Update procrun executables to version 1.1.…
rjernst Nov 29, 2018
0b9095c
re-enable other packaging tests
rjernst Nov 29, 2018
44524c9
remove temp binary
rjernst Nov 29, 2018
fd4d5e2
remove commented out code
rjernst Nov 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion distribution/src/bin/elasticsearch-service.bat
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ if /i %SERVICE_CMD% == start goto doStart
if /i %SERVICE_CMD% == stop goto doStop
if /i %SERVICE_CMD% == manager goto doManagment
echo Unknown option "%SERVICE_CMD%"
exit /B 1
rjernst marked this conversation as resolved.
Show resolved Hide resolved

:displayUsage
echo.
@@ -44,6 +45,7 @@ goto:eof
"%EXECUTABLE%" //ES//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto started
echo Failed starting '%SERVICE_ID%' service
exit /B 1
goto:eof
:started
echo The service '%SERVICE_ID%' has been started
@@ -53,16 +55,18 @@ goto:eof
"%EXECUTABLE%" //SS//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto stopped
echo Failed stopping '%SERVICE_ID%' service
exit /B 1
goto:eof
:stopped
echo The service '%SERVICE_ID%' has been stopped
goto:eof

:doManagment
set EXECUTABLE_MGR=%ES_HOME%\bin\elasticsearch-service-mgr.exe
set EXECUTABLE_MGR=%ES_HOME%\bin\elasticsearch-service-mgr
"%EXECUTABLE_MGR%" //ES//%SERVICE_ID%
if not errorlevel 1 goto managed
echo Failed starting service manager for '%SERVICE_ID%'
exit /B 1
goto:eof
:managed
echo Successfully started service manager for '%SERVICE_ID%'.
@@ -73,6 +77,7 @@ rem Remove the service
"%EXECUTABLE%" //DS//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto removed
echo Failed removing '%SERVICE_ID%' service
exit /B 1
goto:eof
:removed
echo The service '%SERVICE_ID%' has been removed
@@ -177,6 +182,7 @@ if not "%SERVICE_USERNAME%" == "" (

if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_ID%' service
exit /B 1
goto:eof

:installed
Original file line number Diff line number Diff line change
@@ -19,20 +19,20 @@

package org.elasticsearch.packaging;

import org.elasticsearch.packaging.test.DefaultDebPreservationTests;
import org.elasticsearch.packaging.test.DefaultDebBasicTests;
import org.elasticsearch.packaging.test.DefaultRpmPreservationTests;
import org.elasticsearch.packaging.test.DefaultDebPreservationTests;
import org.elasticsearch.packaging.test.DefaultRpmBasicTests;
import org.elasticsearch.packaging.test.OssDebPreservationTests;
import org.elasticsearch.packaging.test.DefaultRpmPreservationTests;
import org.elasticsearch.packaging.test.DefaultTarTests;
import org.elasticsearch.packaging.test.DefaultWindowsServiceTests;
import org.elasticsearch.packaging.test.DefaultZipTests;
import org.elasticsearch.packaging.test.OssDebBasicTests;
import org.elasticsearch.packaging.test.OssRpmPreservationTests;
import org.elasticsearch.packaging.test.OssDebPreservationTests;
import org.elasticsearch.packaging.test.OssRpmBasicTests;
import org.elasticsearch.packaging.test.OssRpmPreservationTests;
import org.elasticsearch.packaging.test.OssTarTests;
import org.elasticsearch.packaging.test.OssWindowsServiceTests;
import org.elasticsearch.packaging.test.OssZipTests;
import org.elasticsearch.packaging.test.DefaultTarTests;
import org.elasticsearch.packaging.test.DefaultZipTests;
import org.elasticsearch.packaging.test.PackageDependenciesTests;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -43,14 +43,15 @@
OssTarTests.class,
DefaultZipTests.class,
OssZipTests.class,
PackageDependenciesTests.class,
DefaultRpmBasicTests.class,
OssRpmBasicTests.class,
DefaultDebBasicTests.class,
OssDebBasicTests.class,
DefaultDebPreservationTests.class,
OssDebPreservationTests.class,
DefaultRpmPreservationTests.class,
OssRpmPreservationTests.class
OssRpmPreservationTests.class,
DefaultWindowsServiceTests.class,
OssWindowsServiceTests.class
})
public class PackagingTests {}
Original file line number Diff line number Diff line change
@@ -22,15 +22,12 @@
import com.carrotsearch.randomizedtesting.annotations.TestCaseOrdering;
import org.apache.http.client.fluent.Request;
import org.elasticsearch.packaging.util.Archives;
import org.elasticsearch.packaging.util.Distribution;
import org.elasticsearch.packaging.util.Installation;
import org.elasticsearch.packaging.util.Platforms;
import org.elasticsearch.packaging.util.ServerUtils;
import org.elasticsearch.packaging.util.Shell;
import org.elasticsearch.packaging.util.Shell.Result;
import org.junit.Before;
import org.junit.BeforeClass;

import org.elasticsearch.packaging.util.Distribution;
import org.elasticsearch.packaging.util.Installation;

import java.io.IOException;
import java.nio.file.Files;
@@ -40,7 +37,6 @@

import static java.util.stream.Collectors.joining;
import static org.elasticsearch.packaging.util.Archives.ARCHIVE_OWNER;
import static org.elasticsearch.packaging.util.Cleanup.cleanEverything;
import static org.elasticsearch.packaging.util.Archives.installArchive;
import static org.elasticsearch.packaging.util.Archives.verifyArchiveInstallation;
import static org.elasticsearch.packaging.util.FileMatcher.Fileness.File;
@@ -55,12 +51,8 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isEmptyString;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeThat;
import static org.junit.Assume.assumeTrue;

/**
* Tests that apply to the archive distributions (tar, zip). To add a case for a distribution, subclass and
@@ -69,22 +61,6 @@
@TestCaseOrdering(TestCaseOrdering.AlphabeticOrder.class)
public abstract class ArchiveTestCase extends PackagingTestCase {

private static Installation installation;

/** The {@link Distribution} that should be tested in this case */
protected abstract Distribution distribution();

@BeforeClass
public static void cleanup() {
installation = null;
cleanEverything();
}

@Before
public void onlyCompatibleDistributions() {
assumeTrue("only compatible distributions", distribution().packaging.compatible);
}

public void test10Install() {
installation = installArchive(distribution());
verifyArchiveInstallation(installation, distribution());
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you 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.
*/

package org.elasticsearch.packaging.test;

import org.elasticsearch.packaging.util.Distribution;

public class DefaultWindowsServiceTests extends WindowsServiceTestCase {

@Override
protected Distribution distribution() {
return Distribution.DEFAULT_ZIP;
}
}
Original file line number Diff line number Diff line change
@@ -19,12 +19,37 @@

package org.elasticsearch.packaging.test;

import junit.framework.TestCase;
import org.elasticsearch.packaging.util.Distribution;
import org.elasticsearch.packaging.util.Platforms;
import org.elasticsearch.packaging.util.Shell;

import java.util.regex.Pattern;

import static org.elasticsearch.packaging.util.Distribution.DEFAULT_DEB;
import static org.elasticsearch.packaging.util.Distribution.OSS_DEB;
import static org.elasticsearch.packaging.util.FileUtils.getDistributionFile;
import static org.junit.Assume.assumeTrue;

public class OssDebBasicTests extends PackageTestCase {

@Override
protected Distribution distribution() {
return Distribution.OSS_DEB;
}

public void test11DebDependencies() {
assumeTrue(Platforms.isDPKG());

final Shell sh = new Shell();

final Shell.Result defaultResult = sh.run("dpkg -I " + getDistributionFile(DEFAULT_DEB));
final Shell.Result ossResult = sh.run("dpkg -I " + getDistributionFile(OSS_DEB));

TestCase.assertTrue(Pattern.compile("(?m)^ Depends:.*bash.*").matcher(defaultResult.stdout).find());
TestCase.assertTrue(Pattern.compile("(?m)^ Depends:.*bash.*").matcher(ossResult.stdout).find());

TestCase.assertTrue(Pattern.compile("(?m)^ Conflicts: elasticsearch-oss$").matcher(defaultResult.stdout).find());
TestCase.assertTrue(Pattern.compile("(?m)^ Conflicts: elasticsearch$").matcher(ossResult.stdout).find());
}
}
Original file line number Diff line number Diff line change
@@ -19,12 +19,40 @@

package org.elasticsearch.packaging.test;

import junit.framework.TestCase;
import org.elasticsearch.packaging.util.Distribution;
import org.elasticsearch.packaging.util.Platforms;
import org.elasticsearch.packaging.util.Shell;

import java.util.regex.Pattern;

import static org.elasticsearch.packaging.util.Distribution.DEFAULT_RPM;
import static org.elasticsearch.packaging.util.Distribution.OSS_RPM;
import static org.elasticsearch.packaging.util.FileUtils.getDistributionFile;
import static org.junit.Assume.assumeTrue;

public class OssRpmBasicTests extends PackageTestCase {

@Override
protected Distribution distribution() {
return Distribution.OSS_RPM;
}

public void test11RpmDependencies() {
assumeTrue(Platforms.isRPM());

final Shell sh = new Shell();

final Shell.Result defaultDeps = sh.run("rpm -qpR " + getDistributionFile(DEFAULT_RPM));
final Shell.Result ossDeps = sh.run("rpm -qpR " + getDistributionFile(OSS_RPM));

TestCase.assertTrue(Pattern.compile("(?m)^/bin/bash\\s*$").matcher(defaultDeps.stdout).find());
TestCase.assertTrue(Pattern.compile("(?m)^/bin/bash\\s*$").matcher(ossDeps.stdout).find());

final Shell.Result defaultConflicts = sh.run("rpm -qp --conflicts " + getDistributionFile(DEFAULT_RPM));
final Shell.Result ossConflicts = sh.run("rpm -qp --conflicts " + getDistributionFile(OSS_RPM));

TestCase.assertTrue(Pattern.compile("(?m)^elasticsearch-oss\\s*$").matcher(defaultConflicts.stdout).find());
TestCase.assertTrue(Pattern.compile("(?m)^elasticsearch\\s*$").matcher(ossConflicts.stdout).find());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you 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.
*/

package org.elasticsearch.packaging.test;

import org.elasticsearch.packaging.util.Distribution;

public class OssWindowsServiceTests extends WindowsServiceTestCase {

@Override
protected Distribution distribution() {
return Distribution.OSS_ZIP;
}
}

This file was deleted.

Loading