Skip to content

Commit 55555a2

Browse files
committed
try to fix abstract class architecture of Sparkbox test
1 parent aa8206e commit 55555a2

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

spark/src/cgcloud/spark/test/test_spark.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@ class BaseSparkClusterTests( CoreTestCase ):
2323
Also covers persistant HDFS between two cluster incarnations.
2424
"""
2525
__metaclass__ = ABCMeta
26-
__test__ = False
2726

2827
node = NotImplemented
2928
cleanup = True
3029
create_image = True
3130

31+
@classmethod
32+
@abc.abstractmethod
33+
def initNode( cls ):
34+
raise NotImplementedError("Abstract method")
35+
3236
@classmethod
3337
def setUpClass( cls ):
38+
cls.initNode
3439
os.environ[ 'CGCLOUD_PLUGINS' ] = 'cgcloud.spark'
3540
super( BaseSparkClusterTests, cls ).setUpClass( )
3641
if cls.create_image:
@@ -42,6 +47,7 @@ def tearDownClass( cls ):
4247
cls._cgcloud( 'delete-image', cls.node )
4348
super( BaseSparkClusterTests, cls ).tearDownClass( )
4449

50+
4551
def test_wordcount( self ):
4652
self._create_cluster( )
4753
try:
@@ -141,14 +147,18 @@ class SparkClusterTests( BaseSparkClusterTests ):
141147
Covers the creation of a Spark v1.x cluster from scratch and running a simple Spark job on it.
142148
Also covers persistant HDFS between two cluster incarnations.
143149
"""
144-
__test__ = True
145-
node = SparkBox.role( )
150+
151+
@classmethod
152+
def initNode( cls ):
153+
cls.node = SparkBox.role( )
146154

147155

148156
class Spark2ClusterTests( BaseSparkClusterTests ):
149157
"""
150158
Covers the creation of a Spark v2.x cluster from scratch and running a simple Spark job on it.
151159
Also covers persistant HDFS between two cluster incarnations.
152160
"""
153-
__test__ = True
154-
node = Spark2Box.role( )
161+
162+
@classmethod
163+
def initNode( cls ):
164+
cls.node = Spark2Box.role( )

0 commit comments

Comments
 (0)