Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

16
Andy Pavlo Andy Pavlo June 27, 2022 June 27, 2022 Testing H- Testing H- Store Store

Transcript of Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

Page 1: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

Andy PavloAndy PavloApril 18, 2023April 18, 2023

Testing H-Testing H-StoreStore

Page 2: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• You must use the “official” Eclipse source code style/format.– Easy to download and install– 4 Space Indentation / No Tabs– Automatic checking coming soon…

Project Rule #1

http://bit.ly/xaF2n7

Page 3: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• Do not commit personal files:– Eclipse settings/metadata.– Temporary files, logs, tarballs.– Pictures of your cat.

Project Rule #2

Page 4: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

XX

Page 5: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• Avoid using locks in your code:– No synchronized, No Semaphores, No

ReentrantLocks.– Never use Vector or Hashtable.– CAS counters are ok (e.g., AtomicInteger)– If you think you need a lock, write a clear

explanation in the code as to why or ask Andy.

Project Rule #3

Page 6: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• Use primitive objects sparingly.– Use int/long instead of Integer/Long– Avoid auto-boxing (Integer.valueOf())

• Don’t allocate short-lived collections– For partition/site objects, use array instead of Map– Consider using an object pool (HStoreObjectPools)

Additional Suggestions

Page 7: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• All test cases for database and projects written using JUnit.• Quick vs. Full– Full requires 2GB of space for testing files.

H-Store Test Harness

http://bit.ly/FR78mj

$ ant junit$ ant junit-full$ ant junit$ ant junit-full

Page 8: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• Continuous integration service automatically tests your project when you push changes to Github.– Must be using latest version (2012-03-16)– Email me your project URL after you merge.

Build & Test Server

Page 9: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

Build & Test Server

http://bit.ly/yB8Rhm

Page 10: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

Build & Test Server

http://bit.ly/yB8Rhm

Page 11: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• Create a new class with ‘Test’ prefix in tests directory:– Real Code:

src/frontend/edu/brown/hstore/wal/Logger.java

– Unit Test Code:tests/frontend/edu/brown/hstore/wal/TestLogger.java

Writing a Simple Unit Test

http://bit.ly/FRkoHw

Page 12: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• Extend edu.brown.BaseTestCase• Any method name that starts with

‘test’ is automatically executed.• Can execute in directly Eclipse.

Writing a Simple Unit Test

http://bit.ly/FRkoHw

Page 13: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.
Page 14: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• Regression test suite allow you to test the full system.• Automatically setup and deploy cluster

configurations directly in tests.– Compiles catalog and provides client handle.– Only on localhost

Writing a Regression Test

http://bit.ly/FRkoHw

Page 15: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.
Page 16: Andy Pavlo November 29, 2015November 29, 2015November 29, 2015 Testing H- Store.

• If you get an UnsatisfiedLinkError, make sure you have the “VM Arguments” configured properly:– Run Configurations → JUnit → Arguments

Writing a Regression Test

-ea -Djava.library.path=obj/release/nativelibs

-ea -Djava.library.path=obj/release/nativelibs http://bit.ly/FRkoHw