"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "server/src/test/java/org/elasticsearch/monitor/os/OsStatsTests.java" between
elasticsearch-6.8.14-src.tar.gz and elasticsearch-6.8.15-src.tar.gz

About: elasticsearch is a Distributed, RESTful, Search Engine built on top of Apache Lucene. Source package (GitHub).

OsStatsTests.java  (elasticsearch-6.8.14-src):OsStatsTests.java  (elasticsearch-6.8.15-src)
skipping to change at line 28 skipping to change at line 28
*/ */
package org.elasticsearch.monitor.os; package org.elasticsearch.monitor.os;
import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
import java.io.IOException; import java.io.IOException;
import static org.hamcrest.Matchers.equalTo;
public class OsStatsTests extends ESTestCase { public class OsStatsTests extends ESTestCase {
public void testSerialization() throws IOException { public void testSerialization() throws IOException {
int numLoadAverages = randomIntBetween(1, 5); int numLoadAverages = randomIntBetween(1, 5);
double loadAverages[] = new double[numLoadAverages]; double loadAverages[] = new double[numLoadAverages];
for (int i = 0; i < loadAverages.length; i++) { for (int i = 0; i < loadAverages.length; i++) {
loadAverages[i] = randomDouble(); loadAverages[i] = randomDouble();
} }
OsStats.Cpu cpu = new OsStats.Cpu(randomShort(), loadAverages); OsStats.Cpu cpu = new OsStats.Cpu(randomShort(), loadAverages);
long memTotal = randomNonNegativeLong(); long memTotal = randomNonNegativeLong();
skipping to change at line 84 skipping to change at line 86
deserializedOsStats.getCgroup().getCpuStat().getNumberOfTime sThrottled()); deserializedOsStats.getCgroup().getCpuStat().getNumberOfTime sThrottled());
assertEquals( assertEquals(
osStats.getCgroup().getCpuStat().getTimeThrottledNanos(), osStats.getCgroup().getCpuStat().getTimeThrottledNanos(),
deserializedOsStats.getCgroup().getCpuStat().getTimeThrottle dNanos()); deserializedOsStats.getCgroup().getCpuStat().getTimeThrottle dNanos());
assertEquals(osStats.getCgroup().getMemoryLimitInBytes(), deseri alizedOsStats.getCgroup().getMemoryLimitInBytes()); assertEquals(osStats.getCgroup().getMemoryLimitInBytes(), deseri alizedOsStats.getCgroup().getMemoryLimitInBytes());
assertEquals(osStats.getCgroup().getMemoryUsageInBytes(), deseri alizedOsStats.getCgroup().getMemoryUsageInBytes()); assertEquals(osStats.getCgroup().getMemoryUsageInBytes(), deseri alizedOsStats.getCgroup().getMemoryUsageInBytes());
} }
} }
} }
public void testGetUsedMemoryWithZeroTotal() {
OsStats.Mem mem = new OsStats.Mem(0, randomNonNegativeLong());
assertThat(mem.getUsed().getBytes(), equalTo(0L));
}
public void testGetUsedSwapWithZeroTotal() {
OsStats.Swap swap = new OsStats.Swap(0, randomNonNegativeLong());
assertThat(swap.getUsed().getBytes(), equalTo(0L));
}
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)